Hi Joakim, Thanks for your reply... > On 9 Jan 2018, at 15:18, Joakim Erdfelt <[email protected]> wrote: > > A directory listing is likely due to nothing handling the default url-pattern > "/" and the DefaultServlet kicking in and showing the directory listing (as > that's how your DefaultServlet is configured).
The default url-pattern “/“ is supposed to be handled by my application, so I wouldn’t expect it to be picked up by the DefaultServlet. Do I need to do something to turn off the DefaultServlet? > Also, what does this do? > > server.addLifeCycleListener(this); > > What does 'this' do with the lifecycle? Ah - sorry. This is just an artefact of how the application is organised. The method to launch Jetty appears in a class that implements LifeCycle.Listener. > It could be the one creating/managing things for Spring (an unusual, but > doable, technique). I don’t think so - I think this is just a convenient way to avoid defining a separate class for the LifeCycle.Listener. The various Listener methods are simply used to update the GUI. Best wishes, Robert > > > Joakim Erdfelt / [email protected] <mailto:[email protected]> > On Tue, Jan 9, 2018 at 8:23 AM, Robert Stroud <[email protected] > <mailto:[email protected]>> wrote: > Hello, > > I have inherited a legacy web application that we distribute as a WAR file > with a separate launcher application that uses Jetty to launch the > application. The web application is built using Grails, which uses the Spring > framework. > > The latest version of Grails uses Spring Boot to build the war file - my > understanding is that Spring Boot depends on version 3.0 of the Servlet > specification and uses a WebApplicationInitializer to bootstrap the > configuration. In particular, there is no web.xml configuration in the war > file. > > I have updated our launcher application to use Jetty 9.4.8, which I believe > supports Servlet 3.x, but when I launch the web application, I see what is > effectively a directory listing of the war file that looks like this: > Directory: / > > META-INF/ <http://localhost:61508/META-INF/> 102 bytes Jan 9, 2018 > 1:35:44 PM > WEB-INF/ <http://localhost:61508/WEB-INF/> 136 bytes Jan 9, 2018 > 1:35:42 PM > assets/ <http://localhost:61508/assets/> 8024 bytes Jan 9, 2018 > 1:35:44 PM > > How do I configure Jetty to recognise the WebApplicationInitializer and load > the Spring Boot application correctly? The current version of the launch code > creates a WebAppContext in the usual way, but I assume I need to do something > different. > WebAppContext context = new WebAppContext(); > context.setWar(APPLICATION_WAR); > context.setContextPath("/"); > > server.setHandler(context); > server.addLifeCycleListener(this); > try { > server.start(); > } catch (Exception e) { > serverError(e.getMessage()); > } > Thank you > > Robert > > > > > > _______________________________________________ > jetty-users mailing list > [email protected] <mailto:[email protected]> > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users > <https://dev.eclipse.org/mailman/listinfo/jetty-users> > > _______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
