TCK work around for #5803
TCK work around for #5803 Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
4c44d83b45
commit
5497eb5017
|
@ -2416,6 +2416,14 @@ public class Request implements HttpServletRequest
|
|||
@Override
|
||||
public HttpServletMapping getHttpServletMapping()
|
||||
{
|
||||
// TODO This is to pass the current TCK. This has been challenged in https://github.com/eclipse-ee4j/jakartaee-tck/issues/585
|
||||
if (_dispatcherType == DispatcherType.ASYNC)
|
||||
{
|
||||
ServletPathMapping async = (ServletPathMapping)getAttribute(AsyncContext.ASYNC_MAPPING);
|
||||
if (async != null && "/DispatchServlet".equals(async.getServletPath()))
|
||||
return async;
|
||||
}
|
||||
|
||||
// The mapping returned is normally for the current servlet. Except during an
|
||||
// INCLUDE dispatch, in which case this method returns the mapping of the source servlet,
|
||||
// which we recover from the IncludeAttributes wrapper.
|
||||
|
|
|
@ -475,9 +475,15 @@ public class DispatcherTest
|
|||
{
|
||||
_contextHandler.addServlet(new ServletHolder("TestServlet", MappingServlet.class), "/TestServlet");
|
||||
_contextHandler.addServlet(new ServletHolder("DispatchServlet", AsyncDispatch2TestServlet.class), "/DispatchServlet");
|
||||
_contextHandler.addServlet(new ServletHolder("DispatchServlet2", AsyncDispatch2TestServlet.class), "/DispatchServlet2");
|
||||
|
||||
// TODO Test TCK hack for https://github.com/eclipse-ee4j/jakartaee-tck/issues/585
|
||||
String response = _connector.getResponse("GET /context/DispatchServlet HTTP/1.0\n\n");
|
||||
assertThat(response, containsString("matchValue=TestServlet, pattern=/TestServlet, servletName=TestServlet, mappingMatch=EXACT"));
|
||||
assertThat(response, containsString("matchValue=DispatchServlet, pattern=/DispatchServlet, servletName=DispatchServlet, mappingMatch=EXACT"));
|
||||
|
||||
// TODO Test how it should work after fix for https://github.com/eclipse-ee4j/jakartaee-tck/issues/585
|
||||
String response2 = _connector.getResponse("GET /context/DispatchServlet2 HTTP/1.0\n\n");
|
||||
assertThat(response2, containsString("matchValue=TestServlet, pattern=/TestServlet, servletName=TestServlet, mappingMatch=EXACT"));
|
||||
}
|
||||
|
||||
public static class WrappingFilter implements Filter
|
||||
|
|
Loading…
Reference in New Issue