https://issues.apache.org/bugzilla/show_bug.cgi?id=53863

          Priority: P2
            Bug ID: 53863
          Assignee: dev@tomcat.apache.org
           Summary: Unable to override default servlet other than in main
                    web.xml
          Severity: critical
    Classification: Unclassified
                OS: All
          Reporter: fernando.ribe...@upic.com.br
          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();

    appCtx.setConfigLocation("/WEB-INF/DispatcherServlet-servlet.xml");

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

    dispatcher.setLoadOnStartup(1);

    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: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to