• 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

Processing multipart/form-data

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of my jsp pages allows a user to upload a file from their computer to the server. The page contents are submitted via HTML Form using the POST method and an enctype equal to "multipart/form-data". I need to write a class that will properly handle this type of request. I have looked through the forum and found several threads refering to this issue. They all state the same thing; use some third-party software. This is not an option for me since all of the code that we use must be developed internally. My question is this, is there any information out there on how to write this code? If so, where? Thanks for any help that you can provide.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you must write all the code that you use (do they expect you to write your own servlet container as well?), you'll need to parse the multi-part request yourself.

I'd grab one of the 3rd party tools that you found mentioned and look at the multi-part parsing code to learn what it entails. In particular, I remeber that looking at the O'Reilly MultipartParser class was very instructive.
 
Christopher Elkins
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear. I'll take a look. Yeah, if it's not part of the java, javax or oracle packages we pretty much have to reinvent the wheel. It's a shame that it usually turns out square.
 
It will give me the powers of the gods. Not bad for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic