/** * Create an HTTPS restlet Server instance matching the given parameters. * * @param port * @param address * @param keystorePath * @param keystorePassword * @param keyPassword */ protected void setupServer(int port, String address, String keystorePath, String keystorePassword, String keyPassword) { Server server = new Server(Protocol.HTTPS,address,port,null); component.getServers().add(server); server.getContext().getParameters().add("keystorePath", keystorePath); server.getContext().getParameters().add("keystorePassword", keystorePassword); server.getContext().getParameters().add("keyPassword", keyPassword); }
/** * Create an HTTPS restlet Server instance matching the given parameters. * * @param port * @param address * @param keystorePath * @param keystorePassword * @param keyPassword */ protected void setupServer(int port, String address, String keystorePath, String keystorePassword, String keyPassword) { Server server = new Server(Protocol.HTTPS,address,port,null); component.getServers().add(server); server.getContext().getParameters().add("keystorePath", keystorePath); server.getContext().getParameters().add("keystorePassword", keystorePassword); server.getContext().getParameters().add("keyPassword", keyPassword); }
server.getContext() .getParameters() .add((String) entry.getKey(), (String) entry.getValue());
Series parameters = server.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", certPath);
Series parameters = server.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", certPath);
/** * 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.setTarget(getTarget()); return super.add(server); }
/** * 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); }
httpServer.getContext().getParameters().addAll(sslConfiguration);
@Inject public RestComponent(@Hello Application helloApp, @Car Application carApp, Verifier authTokenVerifier) { getClients().add(Protocol.HTTPS); Server secureServer = getServers().add(Protocol.HTTPS, 8043); Series<Parameter> parameters = secureServer.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", System.getProperty("javax.net.ssl.keyStorePath")); getDefaultHost().attach("/api/hello", secure(helloApp, authTokenVerifier, "ame")); getDefaultHost().attach("/api/cars", secure(carApp, authTokenVerifier, "ame")); replaceConverter(JacksonConverter.class, new JacksonCustomConverter()); }
/** * Constructor. * * @throws Exception */ public MailServerComponent() throws Exception { // Set basic properties setName("RESTful Mail Server component"); setDescription("Example for 'Restlet in Action' book"); setOwner("Restlet S.A.S."); setAuthor("The Restlet Team"); // Adds a HTTP server connector Server server = getServers().add(Protocol.HTTP, 8111); server.getContext().getParameters().set("tracing", "false"); // Attach the application to the default virtual host getDefaultHost().attachDefault(new MailServerApplication()); } }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); mailServer.getDefaultHost().attach(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 { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); mailServer.getDefaultHost().attach(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 { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); mailServer.getDefaultHost().attach(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 { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); mailServer.getDefaultHost().attach(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 { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); mailServer.getDefaultHost().attach(new MailServerApplication()); mailServer.start(); }
/** * default constructor for UmlgRestletComponent */ public UmlgRestletComponent() { setName("restAndJson"); setDescription("Halo, I am your first comment."); getClients().add(Protocol.FILE); getClients().add(Protocol.CLAP); getClients().add(Protocol.RIAP); Server server = new Server(new Context(), Protocol.HTTP, 8111); server.getContext().getParameters().set("tracing", "true"); getServers().add(server); attachApplications(); }
/** * Launches the application with an HTTP server. * * @param args * The arguments. * @throws Exception */ public static void main(String[] args) throws Exception { Component mailServer = new Component(); // Configure the HTTPS server with the SSL certificates Server server = mailServer.getServers().add(Protocol.HTTPS, 8183); Series<Parameter> parameters = server.getContext().getParameters(); // 1) Configure the SSL key store parameters.add("keystorePath", "src/org/restlet/example/book/restlet/ch05/serverKey.jks"); parameters.add("keystorePassword", "password"); parameters.add("keystoreType", "JKS"); parameters.add("keyPassword", "password"); // 2) Ask client for an SSL certificate parameters.add("wantClientAuthentication", "true"); // 3) Configure the SSL trust store parameters.add("truststorePath", "src/org/restlet/example/book/restlet/ch05/serverTrust.jks"); parameters.add("truststorePassword", "password"); parameters.add("truststoreType", "JKS"); mailServer.getDefaultHost().attach(new MailServerApplication()); mailServer.start(); }
server.getContext().getParameters().set("tracing", "true");
server.getContext().getParameters().set("tracing", "true"); getServers().add(server);
public static void main(String[] args) throws Exception { String[] arguments = new String[1]; arguments[0] = "8111"; // Start the origin server on port 8111 UacServerResource.main(arguments); Component c = new Component(); Server server = new Server(Protocol.SIP); c.getServers().add(server); server.getContext().getParameters().add("tracing", "true"); Client client = new Client(Protocol.SIP); c.getClients().add(client); client.getContext().getParameters().add("proxyHost", "localhost"); client.getContext().getParameters().add("proxyPort", arguments[0]); client.getContext().getParameters().add("tracing", "false"); client.getContext().getParameters() .add("pipeliningConnections", "false"); c.getDefaultHost().attachDefault( new B2buaRedirector(null, "sip:localhost:8111")); c.start(); }