This commit is contained in:
Phillip Webb 2016-09-20 14:32:09 -07:00
parent 0b9667c26f
commit 51092af739
2 changed files with 11 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import javax.ws.rs.Path;
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
import org.apache.tomcat.util.buf.UDecoder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.junit.ClassRule;
@ -104,7 +105,8 @@ public class JerseyAutoConfigurationServletContainerTests {
jerseyServlet.setServlet(new ServletContainer());
jerseyServlet.setOverridable(false);
context.addChild(jerseyServlet);
context.addServletMapping("/*", servletName);
String pattern = UDecoder.URLDecode("/*", "UTF-8");
context.addServletMappingDecoded(pattern, servletName);
}
};

View File

@ -254,7 +254,7 @@ public class TomcatEmbeddedServletContainerFactory
// Otherwise the default location of a Spring DispatcherServlet cannot be set
defaultServlet.setOverridable(true);
context.addChild(defaultServlet);
context.addServletMapping("/", "default");
addServletMapping(context, "/", "default");
}
private void addJspServlet(Context context) {
@ -268,8 +268,13 @@ public class TomcatEmbeddedServletContainerFactory
}
jspServlet.setLoadOnStartup(3);
context.addChild(jspServlet);
context.addServletMapping("*.jsp", "jsp");
context.addServletMapping("*.jspx", "jsp");
addServletMapping(context, "*.jsp", "jsp");
addServletMapping(context, "*.jspx", "jsp");
}
@SuppressWarnings("deprecation")
private void addServletMapping(Context context, String pattern, String name) {
context.addServletMapping(pattern, name);
}
private void addJasperInitializer(TomcatEmbeddedContext context) {