328885 - web overrides do not override
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2423 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
e7fd61ed34
commit
25bfb476ee
|
@ -5,6 +5,7 @@
|
|||
+ 328332 Response.getContentType works with setHeader
|
||||
+ 328523 Fixed overloaded setters in AppProvider
|
||||
+ 328008 Handle update to Servlet Spec 3 Section 8.2.3.h.ii
|
||||
+ 328885 web overrides do not override
|
||||
|
||||
jetty-7.2.0.v20101020 20 October 2010
|
||||
+ 289540 added javadoc into distribution
|
||||
|
|
|
@ -36,6 +36,7 @@ public class FilterHolder extends Holder<Filter>
|
|||
/* ------------------------------------------------------------ */
|
||||
private transient Filter _filter;
|
||||
private transient Config _config;
|
||||
private transient FilterRegistration.Dynamic _registration;
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/** Constructor
|
||||
|
@ -158,7 +159,9 @@ public class FilterHolder extends Holder<Filter>
|
|||
/* ------------------------------------------------------------ */
|
||||
public FilterRegistration.Dynamic getRegistration()
|
||||
{
|
||||
return new Registration();
|
||||
if (_registration == null)
|
||||
_registration = new Registration();
|
||||
return _registration;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -62,6 +62,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
private String _runAsRole;
|
||||
private RunAsToken _runAsToken;
|
||||
private IdentityService _identityService;
|
||||
private ServletRegistration.Dynamic _registration;
|
||||
|
||||
|
||||
private transient Servlet _servlet;
|
||||
|
@ -635,7 +636,9 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
|
|||
|
||||
public ServletRegistration.Dynamic getRegistration()
|
||||
{
|
||||
return new Registration();
|
||||
if (_registration == null)
|
||||
_registration = new Registration();
|
||||
return _registration;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
|
|
|
@ -20,27 +20,21 @@ import java.net.URLClassLoader;
|
|||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.EventListener;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.server.DispatcherType;
|
||||
import javax.servlet.ServletException;
|
||||
import org.eclipse.jetty.servlet.api.ServletRegistration;
|
||||
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintAware;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.authentication.FormAuthenticator;
|
||||
import org.eclipse.jetty.server.DispatcherType;
|
||||
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
|
||||
import org.eclipse.jetty.servlet.FilterHolder;
|
||||
import org.eclipse.jetty.servlet.FilterMapping;
|
||||
import org.eclipse.jetty.servlet.Holder;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.servlet.ServletMapping;
|
||||
import org.eclipse.jetty.util.LazyList;
|
||||
|
@ -179,7 +173,6 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
holder.setName(servlet_name);
|
||||
context.getServletHandler().addServlet(holder);
|
||||
}
|
||||
ServletRegistration.Dynamic registration = holder.getRegistration();
|
||||
|
||||
// init params
|
||||
Iterator iParamsIter = node.iterator("init-param");
|
||||
|
@ -197,7 +190,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
{
|
||||
//init-param not already set, so set it
|
||||
|
||||
registration.setInitParameter(pname, pvalue);
|
||||
holder.setInitParameter(pname, pvalue);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.init-param."+pname, descriptor);
|
||||
break;
|
||||
}
|
||||
|
@ -209,7 +202,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
//otherwise just ignore it
|
||||
if (!(descriptor instanceof FragmentDescriptor))
|
||||
{
|
||||
registration.setInitParameter(pname, pvalue);
|
||||
holder.setInitParameter(pname, pvalue);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.init-param."+pname, descriptor);
|
||||
}
|
||||
break;
|
||||
|
@ -217,7 +210,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
case WebFragment:
|
||||
{
|
||||
//previously set by a web-fragment, make sure that the value matches, otherwise its an error
|
||||
if (!registration.getInitParameter(pname).equals(pvalue))
|
||||
if (!holder.getInitParameter(pname).equals(pvalue))
|
||||
throw new IllegalStateException("Mismatching init-param "+pname+"="+pvalue+" in "+descriptor.getResource());
|
||||
break;
|
||||
}
|
||||
|
@ -244,19 +237,19 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
Log.info("NO JSP Support for {}, did not find {}", context.getContextPath(), servlet_class);
|
||||
jspServletClass = servlet_class = "org.eclipse.jetty.servlet.NoJspServlet";
|
||||
}
|
||||
if (registration.getInitParameter("scratchdir") == null)
|
||||
if (holder.getInitParameter("scratchdir") == null)
|
||||
{
|
||||
File tmp = context.getTempDirectory();
|
||||
File scratch = new File(tmp, "jsp");
|
||||
if (!scratch.exists()) scratch.mkdir();
|
||||
registration.setInitParameter("scratchdir", scratch.getAbsolutePath());
|
||||
holder.setInitParameter("scratchdir", scratch.getAbsolutePath());
|
||||
|
||||
if ("?".equals(registration.getInitParameter("classpath")))
|
||||
if ("?".equals(holder.getInitParameter("classpath")))
|
||||
{
|
||||
String classpath = context.getClassPath();
|
||||
Log.debug("classpath=" + classpath);
|
||||
if (classpath != null)
|
||||
registration.setInitParameter("classpath", classpath);
|
||||
holder.setInitParameter("classpath", classpath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +257,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
/* Set the webapp's classpath for Jasper */
|
||||
context.setAttribute("org.apache.catalina.jsp_classpath", context.getClassPath());
|
||||
/* Set the system classpath for Jasper */
|
||||
registration.setInitParameter("com.sun.appserv.jsp.classpath", getSystemClassPath(context));
|
||||
holder.setInitParameter("com.sun.appserv.jsp.classpath", getSystemClassPath(context));
|
||||
}
|
||||
|
||||
//Set the servlet-class
|
||||
|
@ -342,7 +335,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
case NotSet:
|
||||
{
|
||||
//not already set, so set it now
|
||||
registration.setLoadOnStartup(order);
|
||||
holder.setInitOrder(order);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.load-on-startup", descriptor);
|
||||
break;
|
||||
}
|
||||
|
@ -353,7 +346,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
//if it was already set by a web xml descriptor and we're parsing another web xml descriptor, then override it
|
||||
if (!(descriptor instanceof FragmentDescriptor))
|
||||
{
|
||||
registration.setLoadOnStartup(order);
|
||||
holder.setInitOrder(order);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.load-on-startup", descriptor);
|
||||
}
|
||||
break;
|
||||
|
@ -427,7 +420,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
case NotSet:
|
||||
{
|
||||
//run-as not set, so set it
|
||||
registration.setRunAsRole(roleName);
|
||||
holder.setRunAsRole(roleName);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.run-as", descriptor);
|
||||
break;
|
||||
}
|
||||
|
@ -438,7 +431,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
//run-as was set by a web xml, only allow it to be changed if we're currently parsing another web xml(override/default)
|
||||
if (!(descriptor instanceof FragmentDescriptor))
|
||||
{
|
||||
registration.setRunAsRole(roleName);
|
||||
holder.setRunAsRole(roleName);
|
||||
context.getMetaData().setOrigin(servlet_name+".servlet.run-as", descriptor);
|
||||
}
|
||||
break;
|
||||
|
@ -446,7 +439,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
|||
case WebFragment:
|
||||
{
|
||||
//run-as was set by another fragment, this fragment must show the same value
|
||||
if (!registration.getRunAsRole().equals(roleName))
|
||||
if (!holder.getRunAsRole().equals(roleName))
|
||||
throw new IllegalStateException("Conflicting run-as role "+roleName+" for servlet "+servlet_name+" in "+descriptor.getResource());
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue