Community
Participate
Working Groups
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
Greg, could you please review this request?
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
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
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.
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.