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   * <p>
14   * See <a href="http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/example-jetty-embedded/src/main/resources/fileserver.xml">fileserver.xml</a>
15   */
16  public class FileServerXml
17  {
18      public static void main(String[] args) throws Exception
19      {
20          Resource fileserver_xml = Resource.newSystemResource("fileserver.xml");
21          XmlConfiguration configuration = new XmlConfiguration(fileserver_xml.getInputStream());
22          Server server = (Server)configuration.configure();
23          server.start();
24          server.join();
25      }
26  }