*
The moose likes Other Open Source Projects and the fly likes How to display all headers of  multipart request? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to display all headers of  multipart request?" Watch "How to display all headers of  multipart request?" New topic
Author

How to display all headers of multipart request?

senol ozer
Greenhorn

Joined: Nov 16, 2011
Posts: 2
Hi all!

I would like process multipart request from my servlet. For this, I use the API Apache Common FileUpload.

Here is an example of my request:


Here is my code:


I can't display my "content-id" field.

Can you help me please?
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hi,

Think you can achieve what you want by doing the following:

Use the getItemIterator method instead of the parseRequest method.

Use the FileItemIterator returned to iterate through the FileItemStream instances.

Use the openStream method of the FileItemStream instances to read the contents.

I didn't try it yet, but that's what I can gather by reading the API.

Hope it helps!

Clivant Yeo
My Personal Website
senol ozer
Greenhorn

Joined: Nov 16, 2011
Posts: 2
Thanks for your reply!

I tried your method but it display only the value of the part. For my request example, it display only


Tere is my code:
Clivant Yeo
Ranch Hand

Joined: May 22, 2004
Posts: 124
Hey Senol,

I took a look at the api again. It seems that FileItemStream extends FileItemHeadersSupport, which means that there is a getHeaders() method available from the fileItemStream instances.

API for FileItemStream

API for FileItemHeadersSupport

I have a strong feeling that the getHeaders() method is what you are looking for.

I don't have a Java web container installed on my machine, but let me know if this works.
 
Consider Paul's rocket mass heater.
 
subject: How to display all headers of multipart request?
 
Similar Threads
Apache File Upload - which JAR is required?
Submit multipart and form data
getting nullPointerException on line upload.parseRequest(request);
using ServletFileUpload , List size is always becoming zero
upload.parseRequest(request); giving null.