447629 getPart()/getParts() fails on Multipart request if getParameter is called in a filter first

This commit is contained in:
Jan Bartel 2014-10-23 09:07:27 +11:00
parent 627ba945f1
commit 9cc3f4b206
2 changed files with 26 additions and 4 deletions

View File

@ -579,6 +579,8 @@ public class ServletHandler extends ScopedHandler
res = ((ServletResponseHttpWrapper)res).getResponse(); res = ((ServletResponseHttpWrapper)res).getResponse();
// Do the filter/handling thang // Do the filter/handling thang
servlet_holder.prepare(baseRequest, req, res);
if (chain!=null) if (chain!=null)
chain.doFilter(req, res); chain.doFilter(req, res);
else else

View File

@ -732,8 +732,32 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
_runAsRole = role; _runAsRole = role;
} }
/* ------------------------------------------------------------ */
/**
* Prepare to service a request.
*
* @param baseRequest
* @param request
* @param response
* @throws ServletException
* @throws UnavailableException
*/
protected void prepare (Request baseRequest, ServletRequest request, ServletResponse response)
throws ServletException, UnavailableException
{
MultipartConfigElement mpce = ((Registration)getRegistration()).getMultipartConfig();
if (mpce != null)
baseRequest.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Service a request with this servlet. /** Service a request with this servlet.
* @param baseRequest
* @param request
* @param response
* @throws ServletException
* @throws UnavailableException
* @throws IOException
*/ */
public void handle(Request baseRequest, public void handle(Request baseRequest,
ServletRequest request, ServletRequest request,
@ -773,10 +797,6 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
if (!isAsyncSupported()) if (!isAsyncSupported())
baseRequest.setAsyncSupported(false); baseRequest.setAsyncSupported(false);
MultipartConfigElement mpce = ((Registration)getRegistration()).getMultipartConfig();
if (mpce != null)
request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
servlet.service(request,response); servlet.service(request,response);
servlet_error=false; servlet_error=false;
} }