/** * Sets the next Restlet as a Finder for a given resource class. When the * call is delegated to the Finder instance, a new instance of the resource * class will be created and will actually handle the request. * * @param nextClass * The next resource class to attach. */ public void setNext(Class<? extends ServerResource> nextClass) { setNext(createFinder(nextClass)); }
/** * Constructor using the protocol's default port. * * @param protocol * The connector protocol. * @param nextClass * The next server resource. */ public Server(Protocol protocol, Class<? extends ServerResource> nextClass) { this((Context) null, protocol); setNext(createFinder(nextClass)); }
/** * Constructor. * * @param context * The context. * @param protocol * The connector protocol. * @param nextClass * The next server resource. */ public Server(Context context, Protocol protocol, Class<? extends ServerResource> nextClass) { this(context, protocol); setNext(createFinder(nextClass)); }
/** * Constructor. * * @param protocol * The connector protocol. * @param port * The listening port. * @param nextClass * The next server resource. */ public Server(Protocol protocol, int port, Class<? extends ServerResource> nextClass) { this(protocol, port); setNext(createFinder(nextClass)); }
/** * Constructor. * * @param context * The context. * @param protocol * The connector protocol. * @param port * The listening port. * @param nextClass * The next server resource. */ public Server(Context context, Protocol protocol, int port, Class<? extends ServerResource> nextClass) { this(context, protocol, port); setNext(createFinder(nextClass)); }
/** * Constructor using the protocol's default port. * * @param protocol * The connector protocol. * @param address * The listening IP address (useful if multiple IP addresses * available). You can also use a domain name as an alias for the * IP address to listen to. * @param nextClass * The next server resource. */ public Server(Protocol protocol, String address, Class<? extends ServerResource> nextClass) { this(protocol, address); setNext(createFinder(nextClass)); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Server mailServer = new Server(Protocol.HTTP, 8111); mailServer.setNext(new MailServerApplication()); mailServer.start(); }
/** * Adds a server at the end of the list. * * @return True (as per the general contract of the Collection.add method). */ @Override public boolean add(Server server) { // Set the server's context, if the server does not have already one. if (server.getContext() == null) { server.setContext(getContext().createChildContext()); } server.setNext(getNext()); return super.add(server); }
public static void main( String[] args ) throws Exception { Energy4Java polygene = new Energy4Java( ); Server server = new Server( Protocol.HTTP, 8888 ); Application app = polygene.newApplication( new ForumAssembler(), new MetadataService() ); app.activate(); ContextRestlet restlet = app.findModule( "REST", "Restlet" ).newObject( ContextRestlet.class, new org.restlet.Context() ); ChallengeAuthenticator guard = new ChallengeAuthenticator(null, ChallengeScheme.HTTP_BASIC, "testRealm"); MapVerifier mapVerifier = new MapVerifier(); mapVerifier.getLocalSecrets().put("rickard", "secret".toCharArray()); guard.setVerifier(mapVerifier); guard.setNext(restlet); server.setNext( restlet ); server.start(); } }
server.setNext( guard ); server.start();
server.setNext( guard ); server.start();