updated ChatServer, fixed line endings
git-svn-id: svn://anubis/gvsu@267 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
e98396b032
commit
903877828d
@ -1,66 +1,66 @@
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.restlet.Application;
|
import org.restlet.Application;
|
||||||
import org.restlet.Restlet;
|
import org.restlet.Restlet;
|
||||||
import org.restlet.Component;
|
import org.restlet.Component;
|
||||||
import org.restlet.Restlet;
|
import org.restlet.Restlet;
|
||||||
import org.restlet.Route;
|
import org.restlet.Route;
|
||||||
import org.restlet.Router;
|
import org.restlet.Router;
|
||||||
import org.restlet.data.Protocol;
|
import org.restlet.data.Protocol;
|
||||||
import org.restlet.util.Variable;
|
import org.restlet.util.Variable;
|
||||||
|
|
||||||
public class ChatServer extends Application
|
public class ChatServer extends Application
|
||||||
{
|
{
|
||||||
public ChatServer()
|
public ChatServer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create application root node.
|
/* Create application root node.
|
||||||
* @see org.restlet.Application#createRoot()
|
* @see org.restlet.Application#createRoot()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Restlet createRoot()
|
public Restlet createRoot()
|
||||||
{
|
{
|
||||||
Router router = new Router(getContext());
|
Router router = new Router(getContext());
|
||||||
|
|
||||||
// Add a route for user resources
|
// Add a route for user resources
|
||||||
router.attach("/users", UserResource.class);
|
router.attach("/users", UserResource.class);
|
||||||
|
|
||||||
// Add a route for a user resource
|
// Add a route for a user resource
|
||||||
router.attach("/users/{id}", Userource.class);
|
router.attach("/users/{id}", UserResource.class);
|
||||||
|
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public ObjectContainer getContainer()
|
public ObjectContainer getContainer()
|
||||||
{
|
{
|
||||||
return this.container;
|
return this.container;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args Passed in from the command line.
|
* @param args Passed in from the command line.
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Create a component with an HTTP server connector
|
// Create a component with an HTTP server connector
|
||||||
Component comp = new Component();
|
Component comp = new Component();
|
||||||
comp.getServers().add(Protocol.HTTP, 3000);
|
comp.getServers().add(Protocol.HTTP, 3000);
|
||||||
|
|
||||||
// Attach the application to the default host and start it
|
// Attach the application to the default host and start it
|
||||||
comp.getDefaultHost().attach("/v1", new ChatServer());
|
comp.getDefaultHost().attach("/v1", new ChatServer());
|
||||||
comp.start();
|
comp.start();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
System.out.println("Whoops, our server threw an exception while bootstrapping, details follow.");
|
System.out.println("Whoops, our server threw an exception while bootstrapping, details follow.");
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user