Logger.warn(this, "No exporter for path " + exporterPath + " is registered. Requested url = " + uri);
resp.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
ContentletAPI contentAPI = APILocator.getContentletAPI();
BinaryContentExporter.BinaryContentExporterData data = null;
File inputFile = null;
HttpSession session = req.getSession(false);
List<String> tempBinaryImageInodes = null;
if ( session != null && session.getAttribute( Contentlet.TEMP_BINARY_IMAGE_INODES_LIST ) != null ) {
tempBinaryImageInodes = (List<String>) session.getAttribute( Contentlet.TEMP_BINARY_IMAGE_INODES_LIST );
} else {
tempBinaryImageInodes = new ArrayList<String>();
}
boolean isTempBinaryImage = tempBinaryImageInodes.contains(assetInode);
try {
User user = userWebAPI.getLoggedInUser(req);
boolean respectFrontendRoles = !userWebAPI.isLoggedToBackend(req);
String downloadName = "file_asset";
long lang = APILocator.getLanguageAPI().getDefaultLanguage().getId();
try {
String x = null;
if (session != null) {
x = (String) session.getAttribute(WebKeys.HTMLPAGE_LANGUAGE);
} else {
x = (String) req.getAttribute(WebKeys.HTMLPAGE_LANGUAGE);
}
lang = Long.parseLong(x);
} catch(Exception e){
// Number parsing exception
}
boolean isContent = false;
try {
isContent = isContent(uuid, byInode, lang, respectFrontendRoles);
}catch (DotStateException e) {
resp.sendError(404);
return;
}
if (isContent){
Contentlet content = null;
if(byInode) {
if(isTempBinaryImage)
content = contentAPI.find(assetInode, APILocator.getUserAPI().getSystemUser(), respectFrontendRoles);
else
content = contentAPI.find(assetInode, user, respectFrontendRoles);
assetIdentifier = content.getIdentifier();
} else {
boolean live=userWebAPI.isLoggedToFrontend(req);
if (req.getSession(false) != null && req.getSession().getAttribute("tm_date")!=null) {
live=true;
Identifier ident=APILocator.getIdentifierAPI().find(assetIdentifier);
if(UtilMethods.isSet(ident.getSysPublishDate()) || UtilMethods.isSet(ident.getSysExpireDate())) {
Date fdate=new Date(Long.parseLong((String)req.getSession().getAttribute("tm_date")));