Skip to content

Commit

Permalink
TCK work around for #5803
Browse files Browse the repository at this point in the history
TCK work around for #5803

Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Jan 27, 2021
1 parent 4c44d83 commit 5497eb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,14 @@ ServletPathMapping findServletPathMapping()
@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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,15 @@ public void testDispatchMapping() throws Exception
{
_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
Expand Down

0 comments on commit 5497eb5

Please sign in to comment.