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();
// Do the filter/handling thang
servlet_holder.prepare(baseRequest, req, res);
if (chain!=null)
chain.doFilter(req, res);
else

View File

@ -731,9 +731,33 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
{
_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.
* @param baseRequest
* @param request
* @param response
* @throws ServletException
* @throws UnavailableException
* @throws IOException
*/
public void handle(Request baseRequest,
ServletRequest request,
@ -773,10 +797,6 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
if (!isAsyncSupported())
baseRequest.setAsyncSupported(false);
MultipartConfigElement mpce = ((Registration)getRegistration()).getMultipartConfig();
if (mpce != null)
request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
servlet.service(request,response);
servlet_error=false;
}