|
|
|
@ -48,12 +48,14 @@ public class CloudFoundryCustomContextPathExample {
|
|
|
|
|
return new TomcatServletWebServerFactory() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void prepareContext(Host host, ServletContextInitializer[] initializers) {
|
|
|
|
|
protected void prepareContext(Host host,
|
|
|
|
|
ServletContextInitializer[] initializers) {
|
|
|
|
|
super.prepareContext(host, initializers);
|
|
|
|
|
StandardContext child = new StandardContext();
|
|
|
|
|
child.addLifecycleListener(new Tomcat.FixContextListener());
|
|
|
|
|
child.setPath("/cloudfoundryapplication");
|
|
|
|
|
ServletContainerInitializer initializer = getServletContextInitializer(getContextPath());
|
|
|
|
|
ServletContainerInitializer initializer = getServletContextInitializer(
|
|
|
|
|
getContextPath());
|
|
|
|
|
child.addServletContainerInitializer(initializer, Collections.emptySet());
|
|
|
|
|
child.setCrossContext(true);
|
|
|
|
|
host.addChild(child);
|
|
|
|
@ -69,8 +71,10 @@ public class CloudFoundryCustomContextPathExample {
|
|
|
|
|
@Override
|
|
|
|
|
public void service(ServletRequest req, ServletResponse res)
|
|
|
|
|
throws ServletException, IOException {
|
|
|
|
|
ServletContext context = req.getServletContext().getContext(contextPath);
|
|
|
|
|
context.getRequestDispatcher("/cloudfoundryapplication").forward(req, res);
|
|
|
|
|
ServletContext context = req.getServletContext()
|
|
|
|
|
.getContext(contextPath);
|
|
|
|
|
context.getRequestDispatcher("/cloudfoundryapplication").forward(req,
|
|
|
|
|
res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|