Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[servlet-dev] Runtime Discovery of Servlet Mappings and getNamedDispatcher

Hi,


"As with the included and forwarded request parameters, the HttpServletMapping is not available for servlets that have been obtained with a call to ServletContext.getNamedDispatcher()."

The TCK however contains this test:

   /*
     * @testName: httpServletMappingNamedForwardTest
     * 
     * @assertion_ids: servlet40:httpServletMappingNamedForwardTest;
     * 
     * @test_Strategy:
     */
    @Test
    @RunAsClient
    public void httpServletMappingNamedForwardTest() throws Exception {
        simpleTest("httpServletMappingNamedForwardTest", "/NamedForwardServlet", "GET",
            "matchValue=NamedForwardServlet, pattern=/NamedForwardServlet, servletName=NamedForwardServlet, mappingMatch=EXACT");
    }

Where the NamedForwardServlet is:

public class NamedForwardServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getServletContext()
               .getNamedDispatcher("TestServlet")
               .forward(request, response);
    }
}

The TestServlet is then supposed to have access to a request.getHttpServletMapping() with the values as given in the "simpleTest".

I double checked whether the test is actually executed by the TCK, and it seems to be. From the last GlassFish 6.1.0-RC run:

[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingFilterTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingForwardTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingIncludeTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingNamedForwardTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingNamedIncludeTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingTest2
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#httpServletMappingTest3
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#TrailerTest
[javatest.batch] PASSED........com/sun/ts/tests/servlet/api/jakarta_servlet_http/httpservletrequest40/Client.java#TrailerTest2

Am I completely missing something, or does this blatantly contradict the spec?

Kind regards,
Arjan



Back to the top