J'ai une application avec Embedded Jetty 6.1.26. Servlet 2.5. Voici ma configuration de serveur. Le problème est que lorsque j'essaie d'avoir des JSP et Servlets ensemble, cela ne fonctionne pas. J'ai l'un ou l'autre fonctionnant, selon que j'ai ou server.setHandler()
dans le code ci-dessous. Par "ne fonctionne pas", je veux dire que Jetty renvoie 404, mais sinon il semble bien, même le journal Jetty montre la configuration s'est bien passé - voir http://pastebin.com/PzbEx0qc (c'était avec addHandler(), JSP ne fonctionnait pas).Jetée intégrée: JSP et servlets ensemble?
Les URLS demandées sont
http://localhost:17283/jars?mvnPath= ... et
http://localhost:17283/jsp/index.jsp.
Merci, Ondra
Server server = new Server(PORT);
Context ctx = new Context(server, "/", Context.NO_SECURITY | Context.SESSIONS);
final String WEBAPP_RESOURCES_PATH = "org/jboss/qa/mavenhoe/web/jsp";
final String JSP_CONTEXT_PATH = "/jsp";
// For localhost:port/jsp/index.html and whatever else is in the directory...
final URL warUrl = this.getClass().getClassLoader().getResource(WEBAPP_RESOURCES_PATH);
final String warUrlString = warUrl.toExternalForm();
WebAppContext webAppContext = new WebAppContext(warUrlString, JSP_CONTEXT_PATH);
webAppContext.setAttribute("jarIndex", jarIndex);
server.addHandler(webAppContext);
// .jar's download.
final ServletHolder mavenhoeSH = new ServletHolder(new JarFinderServlet(this.jarIndex));
ctx.addServlet(mavenhoeSH, "/jars");
final ServletHolder shutdownSH = new ServletHolder(new JettyShutdownServlet(server));
shutdownSH.checkServletType();
ctx.addServlet(shutdownSH, "/shutdown");