On 8 November 2012 00:19, Felix Meschberger <fmesc...@adobe.com> wrote: > Hi, > > Am 07.11.2012 um 14:03 schrieb Carsten Ziegeler: > >> Hi, >> >> do you mean using Servlet API 3 or emulating it? > > If Sling sees that it is running in a Servlet API 3 container, the Sling's > ParameterSupport should properly integrate with the Servlet API 3 API. > > I see three options: > > (a) The Sling (Engine) Main Servlet gets the @MultipartConfig annotation. I > don't know (yet) how this annotation will actually affect the servlet > registration in the Http Service. > > (b) The Sling wrapper servlet (when deploying Sling as a Web App gets the > @MultipartConfig annotation. This limits support to web app deployment and > may actually break if the container is not a Servlet API 3 container. > > (c) Provide our own implementation of the getParts and getPart(String) > methods and the Part interface if we have a Servlet API 3 container. The > implementations will be based on the current Sling Parameter Support.
> > Somehow I have the impression, that (c) is probably the best we can do. I agree, a and b are all or nothing options and I suspect that the whole point of @MultpartConfig is to tell the servlet engine that this servlet is special and needs a different, possibly less optimal handling. Doing that to all Sling servlets might be a disadvantage (I have not tested that theory). Does this mean that Sling servlet will be able to use @MultipartConfig and get special treatment wrt the handling of the parts as if they were in a Servlet 3 container ? Ian > > Regards > Felix > >> >> Regards >> Carsten >> >> 2012/11/7 Felix Meschberger <fmesc...@adobe.com>: >>> Hi all, >>> >>> I just realized, that in Servlet API 3 there is now official support for >>> servlet containers to handle multi-part/form-data requests and expose them >>> through the request: >>> >>> public Collection<Part> getParts() >>> public Part getPart(String name) >>> >>> Where Part has these methods: >>> >>> void delete() >>> String getContentType() >>> String getHeader(String name) >>> Collection<String> getHeaderNames() >>> Collection<String> getHeaders(String name) >>> InputStream getInputStream() >>> String getName() >>> long getSize() >>> void write(String fileName) >>> >>> This requires the Servlet to be annotated with @MultipartConfig, though, >>> otherwise the servlet container will not do anything. >>> >>> What is your opinion ? Should we retrofit our multi-part/form-data support >>> into the Servlet API 3 API ? >>> >>> Regards >>> Felix >> >> >> >> -- >> Carsten Ziegeler >> cziege...@apache.org >