• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

session lost in MultipartRequest

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm adding in file uploading features to my application. I'm having a problem that whenever I use enctype ="multipart/form-data" in my jsp page, the session will become null. It works fine when I remove the above enctype, but the file uploading no longer function.
Do you have any idea how to over come this problem?
Any suggestion will be highly appreciated. Thanks a lot.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, it would too. I've never had to support Multipart and Sessions at the same time so I'd never noticed...
You'll probably have to use request.encodeURL() to pass the session and you might have to turn on URL rewriting in the properties of your server (eg if you're using Websphere)
Dave
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Extension to David ..
if you use request.encodeURL()
in a client that has cookies enabled.
the encodeURL() won't work ..
the pedestrian solution would be to encode your own URL
using request.getSession().getID()
and use it to encode the URL manually..

your URL would be as follows
ORIGINAL_URL+ ";jsessionid="+ request.getSession().getId();
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, does this always happen? loosing a session when using enctype ="multipart/form-data" ??
i'm using forte for java and it doesn't seem to happen this.. my application requires the user to log in to upload a file.
i'll have to check that then...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic