Merge branch 'jetty-9.2.x' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project into jetty-9.2.x

This commit is contained in:
Greg Wilkins 2015-01-23 14:57:17 +01:00
commit 934625176f
1 changed files with 18 additions and 10 deletions

View File

@ -745,10 +745,27 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
protected void prepare (Request baseRequest, ServletRequest request, ServletResponse response)
throws ServletException, UnavailableException
{
ensureInstance();
MultipartConfigElement mpce = ((Registration)getRegistration()).getMultipartConfig();
if (mpce != null)
baseRequest.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, mpce);
}
public synchronized Servlet ensureInstance()
throws ServletException, UnavailableException
{
if (_class==null)
throw new UnavailableException("Servlet Not Initialized");
Servlet servlet=_servlet;
if (!isStarted())
throw new UnavailableException("Servlet not initialized", -1);
if (_unavailable!=0 || (!_initOnStartup && servlet==null))
servlet=getServlet();
if (servlet==null)
throw new UnavailableException("Could not instantiate "+_class);
return servlet;
}
/* ------------------------------------------------------------ */
/** Service a request with this servlet.
@ -769,16 +786,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
if (_class==null)
throw new UnavailableException("Servlet Not Initialized");
Servlet servlet=_servlet;
synchronized(this)
{
if (!isStarted())
throw new UnavailableException("Servlet not initialized", -1);
if (_unavailable!=0 || (!_initOnStartup && servlet==null))
servlet=getServlet();
if (servlet==null)
throw new UnavailableException("Could not instantiate "+_class);
}
Servlet servlet = ensureInstance();
// Service the request
boolean servlet_error=true;