On 26/11/2018 17:11, Mark A. Claassen wrote:
> I am having trouble finding a way to override my MultiPart config.  I have a 
> servlet with a configuration in the web.xml.
>               <servlet>
>                             ...
>                             <multipart-config>
>                                           ...
>                             </multipart-config>
>               </servlet>
> 
> However, I would like to be able to be able to configure this outside of the 
> web.xml file so it can be changed outside of the webapp directory.  Is there 
> a way to do this from the "context" in the conf/Catalina/localhost directory?

No.

> Doing it programmatically would be ok for me as well, but I can't find anyway 
> to access the multi-part config through the standard APIs.

You can only do this if you remove the entry from web.xml.

You'd need to register the servlet in a ServletContextListener and then
use ServletContext#addServlet() and then ServletRegistration.Dynamic#
setMultipartConfig()

(along with ading any other configuration / mapping required by the servlet)

> I don't think I can use the annotation @MultipartConfig since I am writing 
> something that extends javax.ws.rs.core.Application and I need to be able to 
> configure this at startup time.

@MultipartConfig has to be added to a Servlet class and can only be
changed by recompilation - which is more work than changing web.xml.

> I am just using Jersey, running inside of Tomcat.
> 
> Thanks!
> 
> Mark Claassen
> Senior Software Engineer
> 
> Donnell Systems, Inc.
> 130 South Main Street
> Leighton Plaza Suite 375
> South Bend, IN  46601
> E-mail: mailto:[email protected]
> Voice: (574)232-3784
> Fax: (574)232-4014
> 
> Disclaimer:
> The opinions provided herein do not necessarily state or reflect
> those of Donnell Systems, Inc.(DSI). DSI makes no warranty for and
> assumes no legal liability or responsibility for the posting.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to