Problem with ServletFileUpload java side

Hi all,

I’m using dhtmlxvault component to allow users to upload files.
This is my client-side code:

var id = “uploadwindow”;
dhxWins = new dhtmlXWindows();
dhxWins.setImagePath("./codebase/imgs/");
dhxWins.createWindow(id, 0, 0, 470, 380);
dhxWins.window(id).setText(“Aggiorna immagine”);
dhxWins.window(id).centerOnScreen();
dhxWins.window(id).attachObject(“obj”);
vault=new dhtmlXVaultObject();
vault.setImagePath(“codebase/imgs/”);
vault.setServerHandlers("./UploadFotoServlet",
“./GetInfoHandler”,
“./GetIdHandler”);
vault.create(“vaultDiv”);

Where UploadFotoServlet is a servlet:


String fileId = request.getParameter(“sessionId”).toString().trim();
// Create a new file upload handler
FileItemFactory factory = new ProgressMonitorFileItemFactory(request, fileId);
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(-1L);
// Parse the request
List items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException ex) {
Logger.getLogger(UploadFotoServlet.class.getName()).log(Level.SEVERE, null, ex);
}

The problem is the items List is always empty. I’m using glassfish 3.1.2 (into J2EE environment) and these libraries:

  • commons-fileupload-1.2.2.jar
  • commons-io-2.3.jar
  • fileupload-progress.jar

If I try this code into a simple web-app, works correctly. I read that the problem seems to be the request object that is “consumed”, but who has read the request?+
Can I solve?