Embeded Jetty with JSP

Simple Jetty server with JSP supported.
  1.     public static void main(String[] args) throws Exception {
  2.         Server server = new Server(8082);

  3.         Configuration.ClassList classlist = Configuration.ClassList.setServerDefault(server);
  4.         classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
  5.                 "org.eclipse.jetty.annotations.AnnotationConfiguration" );

  6.         WebAppContext context = new WebAppContext("src/main/webapp", "/");
  7.         server.setHandler(context);
  8.         server.start();
  9.     }
pom.xml
  1.       <dependency>
  2.           <groupId>org.eclipse.jetty</groupId>
  3.           <artifactId>apache-jsp</artifactId>
  4.           <version>9.4.2.v20170220</version>
  5.       </dependency>
  6.       <dependency>
  7.           <groupId>org.eclipse.jetty</groupId>
  8.           <artifactId>jetty-annotations</artifactId>
  9.           <version>9.4.2.v20170220</version>
  10.       </dependency>


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10742815/viewspace-2135750/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10742815/viewspace-2135750/

你可能感兴趣的:(Embeded Jetty with JSP)