Advertisement
Guest User

Untitled

a guest
Mar 21st, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.27 KB | None | 0 0
  1. object WebMain extends App {
  2.   import org.eclipse.jetty.server.Server
  3.   import org.eclipse.jetty.annotations.AnnotationConfiguration
  4.   import org.eclipse.jetty.plus.webapp.{ EnvConfiguration, PlusConfiguration }
  5.   import org.eclipse.jetty.webapp.{
  6.     WebAppContext, Configuration, FragmentConfiguration, JettyWebXmlConfiguration, MetaInfConfiguration,
  7.     TagLibConfiguration, WebInfConfiguration, WebXmlConfiguration }
  8.  
  9.   val webappPath = "Personality.UI/src/main/webapp"
  10.  
  11.   val server = new Server(8080)
  12.  
  13.   val context = new WebAppContext
  14.  
  15.   context.setResourceBase(webappPath)
  16.   context.setResourceBase(webappPath)
  17.   context.setDescriptor(webappPath + "/WEB-INF/web.xml")
  18.  
  19.   context.setConfigurations(Array[Configuration](
  20.     new AnnotationConfiguration,
  21.     new WebInfConfiguration,
  22.     new WebXmlConfiguration,
  23.     new MetaInfConfiguration,
  24.     new FragmentConfiguration,
  25.     new EnvConfiguration,
  26.     new PlusConfiguration,
  27.     new JettyWebXmlConfiguration
  28.   ))
  29.  
  30.   context.setContextPath("/")
  31.   context.setParentLoaderPriority(true)
  32.  
  33.   server.setHandler(context)
  34.  
  35.   try {
  36.     server.start
  37.     println("\n" * 10)
  38.     server.dumpStdErr
  39.     server.join
  40.   }
  41.   catch { case e: Throwable => e.printStackTrace; System.exit(1) }
  42.   finally System.exit(0)
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement