/** * 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); }
/** * Constructor. * * @param server * The parent server connector. */ public ServerCall(Server server) { this((server == null) ? null : server.getAddress(), (server == null) ? 0 : server.getPort()); }
/** * 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)); }
Series parameters = server.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", certPath);
server = new Server(new Context(), Protocol.SIP, Integer.parseInt(args[0]), UacServerResource.class); } else { server = new Server(new Context(), Protocol.SIP, UacServerResource.class); server.getContext() .getParameters() .add((String) entry.getKey(), (String) entry.getValue()); server.start();
"Please specify a port when defining a list of protocols."); } else { server = new Server(new Context(), protocolsList, getInt(portNode, Protocol.UNKNOWN_PORT), final Protocol protocol = getProtocol(item .getNodeValue()); server = new Server( new Context(), protocol, .getNodeValue(); if (address != null) { server.setAddress(address); && (valueNode != null)) { server .getContext() .getParameters() .add(
/** * 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; }
/** * 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 the ephemeral port in the attributes map if necessary. * * @param localPort * The ephemeral local port. */ public void setEphemeralPort(int localPort) { // If an ephemeral port is used, make sure we update the attribute for // the API if (getHelped().getPort() == 0) { getAttributes().put("ephemeralPort", localPort); } }
/** * 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 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); }
/** * Returns the actual server port after it has started. If an ephemeral port * is used it will be returned, otherwise the fixed port will be provided. * * @return The actual server port. */ public int getActualPort() { return (getPort() == 0) ? getEphemeralPort() : getPort(); }
if (server.getProtocols().contains(protocol) && (server.getPort() == protocol.getDefaultPort())) { exists = true; if (server.getProtocols().contains(protocol) && (server.getPort() == port)) { exists = true;
/** * Starts the server connectors. * * @throws Exception */ protected synchronized void startServers() throws Exception { if (this.servers != null) { for (final Server server : this.servers) { server.start(); } } }
/** * Stops the server connectors. * * @throws Exception */ protected synchronized void stopServers() throws Exception { if (this.servers != null) { for (final Server server : this.servers) { server.stop(); } } }
Series parameters = server.getContext().getParameters(); parameters.add("sslContextFactory", "org.restlet.engine.ssl.DefaultSslContextFactory"); parameters.add("keyStorePath", certPath);
Server httpServer = new Server(Protocol.valueOf(DccAgentEndpoint.DEFAULT_PROTOCOL), port); restletComponent.getServers().getContext().getParameters() .add("persistingConnections", Boolean.FALSE.toString()); httpServer.getContext().getParameters().addAll(sslConfiguration); httpServer.start(); restletComponent.start();