google-code-export / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
1 stars 0 forks source link

UploadServlet.getUploadedFile does not get the correct session #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Repro steps:
1. Save an attribute into the session somewhere in your application:
session.setAttribute("someAttribute", "someValue");
2. Extends UploadAction and override getUploadedFile.
3. Debug and check the request object passed into getUploadedFile.

Expected result:
The request object should contain the session with the attribute set in step 1.

Actual result:
In getUploadedFile, request.getSesstion().getAttribute("someAttribute") is null;

Envirnment:
gwtupload 0.6.4 snapshot, Java 1.6, GWT2.3

Additional info:
UploadAction.executeAction doesn't have this problem
I'm trying to use session to make sure the user is logged in.

Original issue reported on code.google.com by warren.c...@gmail.com on 25 Oct 2011 at 6:26

GoogleCodeExporter commented 9 years ago
This is not an issue related with gwtupload but with the servlet container.

Gwtupload uses the container session, it sends a request (see [1]) before 
sending a file to assure we can use the session because some containers do not 
initialize session until we use it.

You can use firebug to see cookies values and figure out if you have an issue 
with your server. If you use apache in front of your application server and you 
are rewriting paths you could have some problems because the session cookie 
could be associated with the url path.

[1] 
http://code.google.com/p/gwtupload/source/browse/trunk/GwtUpload/core/src/main/j
ava/gwtupload/server/UploadServlet.java#517

Original comment by manuel.carrasco.m on 9 Nov 2011 at 7:25