Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Embedded Jetty Servlet 3.0

The way we do this is to set the Multipart config on the request manually:

      request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, new MultipartConfigElement(

Only thing to watch out for is that you do not make Request parse the parameters (e.g. a call to getParameter("")) before adding the multipart config, as the request parameters are only parsed a single time, so the following is fine:

public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
         request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, new MultipartConfigElement(


Rather than doing this in every handler which handles multipart requests, we have a AbstractHandler in a Handler list which checks to see if the request content type is multipart, and if so, adds the above attribute to the request.

On Mon, Dec 2, 2013 at 7:41 PM, Ramirez, Edwin <edwin.ramirez@xxxxxxxx> wrote:

Thank you for your reply.  I'll take a look at the example.  However, I don't use "WebAppContext()", I instead have an AbstractHandler implementation.  How do I set the configuration of the AbstractHandler implementation?

Edwin S. Ramirez

Date: Mon, 2 Dec 2013 07:13:19 -0700
From: Joakim Erdfelt <joakim@xxxxxxxxxxx>
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] Embedded Jetty Servlet 3.0
Content-Type: text/plain; charset="iso-8859-1"

This example project might help...

Look at the src/test/java/com/company/foo/<>
an example on how to setup the server configuration for various Servlet 3.x

jetty-users mailing list

Back to the top