I use jetty in my spring app. After migrating from Jetty 8 to Jetty 9 (replacing SelectChannelConnector with ServerConnector) I'm left with 404 error code after navigating to main website address (spring security redirects me to /login) and log:
ERROR: PWC6117: File "/Users/jonny/projects/mypro/modules/backoffice/src/main/webapp/login" not found
it looks like jetty 9 doesn't honor web.xml file?, which is in my case
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/login.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
and my configuration of WebApp object is:
Server server = new Server();
WebAppContext webapp = new WebAppContext();
webapp.setContextPath(path);
webapp.setDescriptor("*src/main/webapp*/WEB-INF/web.xml");
webapp.setBaseResource(new ResourceCollection("*src/main/webapp*"));
HandlerList handlers = new HandlerList();
ServerConnector connector = new ServerConnector(server);
connector.setPort(*port*);
server.setConnectors(new Connector[]{connector});
handlers.addHandler(webApp);
server.setHandler(handlers);
server.start();
server.join();
I wish that /login
served login.jsp
, how to do that?
But the body of login.jsp
is pure html and all I want is to serve it from /login
context
Old: While searching for a hint I red:
- Map jetty ResourceHandler to a URL
- ResourceHandler stop hosting files with jetty 9 - 404 not found error (works fine with jetty 8)
- Serving static files w/ embedded Jetty
but still don't know how to properly setup jetty with web.xml
, any ideas?
jsp-file
addservlet-class
and that would work fine, but this is rather unpleasant and I wish to have jsp file – hanskoff