Commit 41df4ee4 by Tuomas Riihimäki

Glassfish 4.1 changes behaviour of getRealPath() so that it requires the file to exist.

1 parent 296f1b73
...@@ -264,7 +264,7 @@ public class UserBean implements UserBeanLocal { ...@@ -264,7 +264,7 @@ public class UserBean implements UserBeanLocal {
@RolesAllowed(SpecialPermission.S_USER) @RolesAllowed(SpecialPermission.S_USER)
public UserImage uploadImage(EventUser user, String contentType, InputStream imagestream, String filename, String description) { public UserImage uploadImage(EventUser user, String contentType, InputStream imagestream, String filename, String description) {
user = eventUserFacade.merge(user); user = eventUserFacade.reload(user);
logger.debug("uploading image to userid {}", user); logger.debug("uploading image to userid {}", user);
EventUser curruser = permbean.getCurrentUser(); EventUser curruser = permbean.getCurrentUser();
......
...@@ -111,9 +111,13 @@ public class FileDownloadServlet extends GenericImageServlet { ...@@ -111,9 +111,13 @@ public class FileDownloadServlet extends GenericImageServlet {
// Create image on file for cropper to work... // Create image on file for cropper to work...
// Check // Check
// http://code.google.com/p/primefaces/issues/detail?id=3751 // http://code.google.com/p/primefaces/issues/detail?id=3751
String imagefilePath = this.getServletContext().getRealPath("/dydata/" + super.request.getPathInfo()); String dydataRoot = this.getServletContext().getRealPath("/dydata/");
File imagefile = new File(imagefilePath);
if (!imagefile.exists()) File imagefile = null;
if (dydataRoot != null) {
imagefile = new File(dydataRoot + super.request.getPathInfo());
}
if (imagefile != null && !imagefile.exists())
{ {
File parentPath = new File(imagefile.getParent()); File parentPath = new File(imagefile.getParent());
if (!parentPath.isDirectory() && !parentPath.mkdirs()) { if (!parentPath.isDirectory() && !parentPath.mkdirs()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!