Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349110 - MultiPartFilter does not record the content-type of uploaded files
Summary: MultiPartFilter does not record the content-type of uploaded files
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 7.2.x   Edit
Assignee: Jan Bartel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-11 02:53 EDT by Yaytay CLA
Modified: 2011-11-15 03:13 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yaytay CLA 2011-06-11 02:53:41 EDT
Build Identifier: jetty-servlets-7.4.1.v20110513

When a file is uploaded the MultiPartFilter does not make the content-type of the part available to clients.
A map of part names to content types would be useful for clients that want this information.

Reproducible: Always
Comment 1 Michael Gorovoy CLA 2011-06-27 16:39:35 EDT
Greg, could you please review this request?
Comment 2 Jan Bartel CLA 2011-06-29 21:37:25 EDT
Yaytay,

Just FYI, the Servlet 3.0 spec provides an API to retrieve the content-type of multipart mime requests, javax.servlet.http.Part. Jetty-8 implements the Servlet 3.0 spec.

Jan
Comment 3 Greg Wilkins CLA 2011-08-29 00:48:09 EDT
This would be reasonable functionality to add, but a fairly low priority as servlet 3.0 already solves this.   Patches welcome to help hurry up a fix, else we will look at this as best we can
Comment 4 Thomas Becker CLA 2011-10-14 11:49:08 EDT
Parsing the content-types for each boundary in MultipartFilter.doFilter() is pretty easy. However I've no idea how to expose that to the client as we can't change the method signature for a javax.servlet.Filter. Instance variables are not an option here as it's not threadsafe.


As this info is available in servlet 3.x, I won't spend any more time on this for now unless someone has a good suggestion for me.
Comment 5 Jan Bartel CLA 2011-11-15 03:13:20 EST
The content type can be retrieved as the request parameter:

name+".org.eclipse.jetty.servlet.contentType"

eg given:

 Content-Disposition: form-data; name="fileup"; filename="test.upload"
 Content-Type: application/octet-stream

then 

request.getParameter("fileup.org.eclipse.jetty.servlet.contentType") returns "application/octet-stream"

Fixed for jetty-7.5.5.