/** * 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); }
/** * Adds a new server connector in the map supporting the given protocol on * the specified port. * * @param protocol * The connector protocol. * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, int port) { Server result = new Server(protocol, null, port, getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Sets a modifiable list of server connectors. Method synchronized to make * compound action (clear, addAll) atomic, not for visibility. * * @param servers * A modifiable list of server connectors. */ public synchronized void setServers(ServerList servers) { this.servers.clear(); if (servers != null) { this.servers.addAll(servers); } }
/** * Adds a new server connector in the map supporting the given protocol on * the specified port. * * @param protocol * The connector protocol. * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, int port) { Server result = new Server(protocol, null, port, getNext()); add(result); return result; }
List<Parameter> sslConfiguration = ctx.getBean("sslConfiguration", List.class); Server httpServer = new Server(Protocol.valueOf(DccAgentEndpoint.DEFAULT_PROTOCOL), port); restletComponent.getServers().getContext().getParameters() .add("persistingConnections", Boolean.FALSE.toString()); restletComponent.getServers().add(httpServer);
/** * Constructor. */ public Component() { super(); this.hosts = new CopyOnWriteArrayList<VirtualHost>(); this.clients = new ClientList(null); this.servers = new ServerList(null, this); this.realms = new CopyOnWriteArrayList<Realm>(); this.services = new ServiceList(getContext()); if (Engine.getInstance() != null) { // To be done before setting the helper... this.services.add(new org.restlet.service.TaskService()); this.helper = new ComponentHelper(this); Context childContext = getContext().createChildContext(); this.defaultHost = new VirtualHost(childContext); this.internalRouter = new InternalRouter(childContext); this.services.add(new LogService()); getLogService().setContext(childContext); this.services.add(new StatusService()); getStatusService().setContext(childContext); this.clients.setContext(childContext); this.servers.setContext(childContext); } }
/** * 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); }
/** * Adds a new server connector in the map supporting the given protocol on * the specified IP address and port. * * @param protocol * The connector protocol. * @param address * The optional listening IP address (useful if multiple IP * addresses available). * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, String address, int port) { Server result = new Server(protocol, address, port, getNext()); add(result); return result; }
this.hosts = new CopyOnWriteArrayList<VirtualHost>(); this.clients = new ClientList(null); this.servers = new ServerList(null, this); this.statusService = new StatusService(true); this.clients.setContext(getContext()); this.servers.setContext(getContext());
public void start() throws Exception { _component.getServers().add(Protocol.HTTP, Integer.parseInt(_config.getControllerPort())); _component.getClients().add(Protocol.FILE); _component.getClients().add(Protocol.JAR);
/** * Adds a new server connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added server. */ public Server add(Protocol protocol) { Server result = new Server(protocol, null, protocol.getDefaultPort(), getNext()); add(result); return result; }
/** * Adds a new server connector in the map supporting the given protocol on * the specified IP address and port. * * @param protocol * The connector protocol. * @param address * The optional listening IP address (useful if multiple IP * addresses available). * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, String address, int port) { Server result = new Server(protocol, address, port, getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Sets the modifiable list of server connectors. This method clears the * current list and adds all entries in the parameter list. * * @param servers * A list of server connectors. */ public void setServers(ServerList servers) { synchronized (getServers()) { if (servers != getServers()) { getServers().clear(); if (servers != null) { getServers().addAll(servers); } } } }
/** * Sets the list of servers, either as protocol names, Protocol instances or * Server instances. * * @param serversInfo * The list of servers. */ public void setServersList(List<Object> serversInfo) { for (final Object serverInfo : serversInfo) { if (serverInfo instanceof String) { getServers().add(Protocol.valueOf((String) serverInfo)); } else if (serverInfo instanceof Protocol) { getServers().add((Protocol) serverInfo); } else if (serverInfo instanceof Server) { getServers().add((Server) serverInfo); } else { getLogger() .warning( "Unknown object found in the servers list. Only instances of String, org.restlet.data.Protocol and org.restlet.Server are allowed."); } } }
/** * Adds a new server connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added server. */ public Server add(Protocol protocol) { Server result = new Server(protocol, null, protocol.getDefaultPort(), getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Creates and starts component. Pass 'auto' or 'explicit' (or a prefix of * either) to control how the Injector is created. Default is auto. */ public static void main(String[] args) throws Exception { if (args.length > 0) { if ("explicit".startsWith(args[0])) { mode = Mode.EXPLICIT_INJECTOR; } else if (!"auto".startsWith(args[0])) { System.out .println("Call with prefix of 'auto' (default) or 'explicit'"); System.exit(1); } } Component component = new Component(); component.getServers().add(Protocol.HTTP, 8182); component.getDefaultHost().attach(new Main()); component.start(); }
else { logger.trace(String.format("Going to bind HTTP interface to port %d", HTTPPort)); component.getServers().add(Protocol.HTTP, HTTPPort); logger.trace(String.format("Cert located at %s", certPath)); Server server = component.getServers().add(Protocol.HTTPS, HTTPSPort); Series parameters = server.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory");