• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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...
 
You can't expect to wield supreme executive power just because
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic