VIVO-82 FileServingServlet must use an existing WADF.

Request-specific WebappDaoFactory objects are not initialized on image requests.
This commit is contained in:
j2blake 2013-06-07 16:22:33 -04:00
parent 69ab12c4bc
commit 57c962e82a

View file

@ -87,19 +87,19 @@ public class FileServingServlet extends VitroHttpServlet {
InputStream in; InputStream in;
String mimeType = null; String mimeType = null;
try { try {
FileInfo fileInfo = figureFileInfo( FileInfo fileInfo = figureFileInfo(request.getWebappDaoFactory(),
request.getFullWebappDaoFactory(), path); path);
mimeType = fileInfo.getMimeType(); mimeType = fileInfo.getMimeType();
String actualFilename = findAndValidateFilename(fileInfo, path); String actualFilename = findAndValidateFilename(fileInfo, path);
in = openImageInputStream(fileInfo, actualFilename); in = openImageInputStream(fileInfo, actualFilename);
} catch (FileServingException e) { } catch (FileServingException e) {
log.info("Failed to serve the file at '" + path + "' -- " + e.getMessage()); log.info("Failed to serve the file at '" + path + "' -- " + e);
in = openMissingLinkImage(request); in = openMissingLinkImage(request);
mimeType = "image/png"; mimeType = "image/png";
} catch (Exception e) { } catch (Exception e) {
log.warn("Failed to serve the file at '" + path + "' -- " + e.getMessage()); log.warn("Failed to serve the file at '" + path + "' -- " + e);
in = openMissingLinkImage(request); in = openMissingLinkImage(request);
mimeType = "image/png"; mimeType = "image/png";
} }