diff --git a/cs656/lab4/ChatServer.java b/cs656/lab4/ChatServer.java index 2509f56..fb5d894 100644 --- a/cs656/lab4/ChatServer.java +++ b/cs656/lab4/ChatServer.java @@ -1,66 +1,66 @@ - -import java.io.File; - -import org.restlet.Application; -import org.restlet.Restlet; -import org.restlet.Component; -import org.restlet.Restlet; -import org.restlet.Route; -import org.restlet.Router; -import org.restlet.data.Protocol; -import org.restlet.util.Variable; - -public class ChatServer extends Application -{ - public ChatServer() - { - } - - /* Create application root node. - * @see org.restlet.Application#createRoot() - */ - @Override - public Restlet createRoot() - { - Router router = new Router(getContext()); - - // Add a route for user resources - router.attach("/users", UserResource.class); - - // Add a route for a user resource - router.attach("/users/{id}", Userource.class); - - return router; - } - - /* - public ObjectContainer getContainer() - { - return this.container; - } - */ - - /** - * @param args Passed in from the command line. - */ - public static void main(String[] args) - { - try - { - // Create a component with an HTTP server connector - Component comp = new Component(); - comp.getServers().add(Protocol.HTTP, 3000); - - // Attach the application to the default host and start it - comp.getDefaultHost().attach("/v1", new ChatServer()); - comp.start(); - } - catch (Exception ex) - { - System.out.println("Whoops, our server threw an exception while bootstrapping, details follow."); - ex.printStackTrace(); - } - - } - -} + +import java.io.File; + +import org.restlet.Application; +import org.restlet.Restlet; +import org.restlet.Component; +import org.restlet.Restlet; +import org.restlet.Route; +import org.restlet.Router; +import org.restlet.data.Protocol; +import org.restlet.util.Variable; + +public class ChatServer extends Application +{ + public ChatServer() + { + } + + /* Create application root node. + * @see org.restlet.Application#createRoot() + */ + @Override + public Restlet createRoot() + { + Router router = new Router(getContext()); + + // Add a route for user resources + router.attach("/users", UserResource.class); + + // Add a route for a user resource + router.attach("/users/{id}", UserResource.class); + + return router; + } + + /* + public ObjectContainer getContainer() + { + return this.container; + } + */ + + /** + * @param args Passed in from the command line. + */ + public static void main(String[] args) + { + try + { + // Create a component with an HTTP server connector + Component comp = new Component(); + comp.getServers().add(Protocol.HTTP, 3000); + + // Attach the application to the default host and start it + comp.getDefaultHost().attach("/v1", new ChatServer()); + comp.start(); + } + catch (Exception ex) + { + System.out.println("Whoops, our server threw an exception while bootstrapping, details follow."); + ex.printStackTrace(); + } + + } + +}