View Javadoc

1   package org.eclipse.jetty.embedded;
2   
3   import org.eclipse.jetty.server.Server;
4   import org.eclipse.jetty.util.resource.Resource;
5   import org.eclipse.jetty.xml.XmlConfiguration;
6   
7   
8   /* ------------------------------------------------------------ */
9   /** A Jetty FileServer.
10   * This server is identical to {@link FileServer}, except that it
11   * is configured via an {@link XmlConfiguration} config file that
12   * does the identical work.
13   * @see http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/example-jetty-embedded/src/main/resources/fileserver.xml
14   */
15  public class FileServerXml
16  {
17      public static void main(String[] args) throws Exception
18      {
19          Resource fileserver_xml = Resource.newSystemResource("fileserver.xml");
20          XmlConfiguration configuration = new XmlConfiguration(fileserver_xml.getInputStream());
21          Server server = (Server)configuration.configure();
22          server.start();
23          server.join();
24      }
25  }