tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 53863] New: Unable to override default servlet other than in main web.xml
Date Thu, 13 Sep 2012 03:44:28 GMT

          Priority: P2
            Bug ID: 53863
           Summary: Unable to override default servlet other than in main
          Severity: critical
    Classification: Unclassified
                OS: All
          Hardware: PC
            Status: NEW
           Version: 7.0.30
         Component: Catalina
           Product: Tomcat 7

An implementation of ServletContainerInitializer can't add a mapping to "/"
because the default servlet is loaded first, as first reported in 51278:

public final class SampleServletContainerInitializer implements
ServletContainerInitializer {

  public void onStartup(final Set<Class<?>> c, final ServletContext ctx) throws
ServletException {
    final XmlWebApplicationContext appCtx = new XmlWebApplicationContext();


    final ServletRegistration.Dynamic dispatcher =
ctx.addServlet("DispatcherServlet", new DispatcherServlet(appCtx));


    final Set<String> conflictSet = dispatcher.addMapping("/");

    for (final String conflict : conflictSet)
      out.println(conflict); // prints "/"



A test case follows attached.

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message