Refine search
public void start() throws Exception { _component.getServers().add(Protocol.HTTP, Integer.parseInt(_config.getControllerPort())); _component.getClients().add(Protocol.FILE); _component.getClients().add(Protocol.JAR); _component.getClients().add(Protocol.WAR); final Context applicationContext = _component.getContext().createChildContext(); applicationContext.getAttributes().put(ControllerConf.class.toString(), _config); applicationContext.getAttributes().put(HelixMirrorMakerManager.class.toString(), _helixMirrorMakerManager); applicationContext.getAttributes().put(ValidationManager.class.toString(), _validationManager); _component.getDefaultHost().attach(_controllerRestApp); _component.start(); } catch (final Exception e) { LOGGER.error("Caught exception while starting controller", e);
component = new Component(); component.getClients().add(Protocol.FILE); component.getClients().add(Protocol.CLAP); Guard guard = new RateLimitGuard(null, ChallengeScheme.HTTP_DIGEST, "Authentication Required"); guard.getSecrets().put(authLogin, authPassword.toCharArray()); component.getDefaultHost().attach(guard); guard.setNext(new EngineApplication(engine)); component.start(); startupOut.println("engine listening at port "+port); startupOut.println("operator login set per " + component.stop();
public static void main(String[] args) throws Exception { // Create a new Component. Component component = new Component(); // Add a new HTTP server listening on port 8182. component.getServers().add(Protocol.HTTP, 8182); // Attach the sample application. component.getDefaultHost().attach("/firstSteps", new FirstStepsApplication()); // Start the component. component.start(); }
public static void main(String[] args) throws Exception { // create Component (as ever for Restlet) final Component comp = new Component(); final Server server = comp.getServers().add(Protocol.HTTP, 80); // create JAX-RS runtime environment final JaxRsApplication application = new JaxRsApplication(comp .getContext().createChildContext()); // attach ApplicationConfig application.add(new ExampleApplication()); // Attach the application to the component and start it comp.getDefaultHost().attach(application); comp.start(); System.out.println("Server started on port " + server.getPort()); System.out.println("Press key to stop server"); System.in.read(); System.out.println("Stopping server"); comp.stop(); System.out.println("Server stopped"); } }
public synchronized void start() throws Exception { LOG.info("helixAdminWebApp starting"); if (_component == null) { _zkClient = new ZkClient(_zkServerAddress, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); _rawZkClient = new ZkClient(_zkServerAddress, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ByteArraySerializer()); _component = new Component(); _component.getServers().add(Protocol.HTTP, _helixAdminPort); Context applicationContext = _component.getContext().createChildContext(); applicationContext.getAttributes() .put(RestAdminApplication.ZKSERVERADDRESS, _zkServerAddress); applicationContext.getAttributes().put(RestAdminApplication.PORT, "" + _helixAdminPort); applicationContext.getAttributes().put(RestAdminApplication.ZKCLIENT, _zkClient); applicationContext.getAttributes().put(ResourceUtil.ContextKey.RAW_ZKCLIENT.toString(), _rawZkClient); _adminApp = new RestAdminApplication(applicationContext); // Attach the application to the component and start it _component.getDefaultHost().attach(_adminApp); _component.start(); } LOG.info("helixAdminWebApp started on port: " + _helixAdminPort); }
protocolsList.add(getProtocol(protocol)); client = new Client(new Context(), getProtocol(item .getNodeValue())); getClients().add(client); protocolsList.add(getProtocol(protocol)); final int port = getInt(portNode, Protocol.UNKNOWN_PORT); getLogger() .warning( "Please specify a port when defining a list of protocols."); protocolsList, getInt(portNode, Protocol.UNKNOWN_PORT), getServers().getTarget()); final Protocol protocol = getProtocol(item .getNodeValue()); getInt(portNode, protocol.getDefaultPort()), getServers().getTarget()); getServers().add(server); parseHost(getDefaultHost(), childNode);
public void setUp() throws Exception this.component = new Component(); this.component.getServers().add(Protocol.HTTP, AbstractResourceImplTest.TEST_PORT); this.component.getClients().add(Protocol.CLAP); this.component.getClients().add(Protocol.HTTP); new OasWebServiceApplicationImpl(this.component.getContext().createChildContext()); this.component.getDefaultHost().attach("/oas-test/", nextApplication); this.component.start();
getComponent().getClients().add(client); protocolsList, getInt(portNode, Protocol.UNKNOWN_PORT), getComponent().getServers() .getNext()); protocol, getInt(portNode, protocol.getDefaultPort()), getComponent().getServers().getNext()); getComponent().getServers().add(server); getComponent().getContext().getParameters().add(p); parseHost(getComponent().getDefaultHost(), childNode); } else if ("host".equals(childNode.getNodeName())) { final VirtualHost host = new VirtualHost(getComponent() .getContext()); parseHost(host, childNode); getComponent().getHosts().add(host); } else if ("internalRouter".equals(childNode.getNodeName())) { parseRouter(getComponent().getInternalRouter(), childNode); } else if ("logService".equals(childNode.getNodeName())) { getComponent().getLogService() .setResponseLogFormat(item.getNodeValue());
/** Starts the Restlet. */ @Override public synchronized void start() throws Exception { // Attach all virtual hosts for (VirtualHost host : getComponent().getHosts()) { getRoutes().add(new HostRoute(this, host)); } // Also attach the default host if it exists if (getComponent().getDefaultHost() != null) { getRoutes().add( new HostRoute(this, getComponent().getDefaultHost())); } // If no host matches, display and error page with a precise message final Restlet noHostMatched = new Restlet(getComponent().getContext() .createChildContext()) { @Override public void handle(Request request, Response response) { response.setStatus(Status.CLIENT_ERROR_NOT_FOUND, "No virtual host could handle the request"); } }; setDefaultRoute(new org.restlet.routing.TemplateRoute(this, "", noHostMatched)); // Start the router super.start(); }
Component component = new Component(); component.getServers().add(Protocol.HTTP, 8182); MyApplication app = new MyApplication(); component.getDefaultHost().attachDefault(app); component.getInternalRouter().attachDefault(app);
@Override public synchronized void stop() throws Exception { // Stop the server's router getServerRouter().stop(); // Stop all applications stopHostApplications(getHelped().getDefaultHost()); for (VirtualHost host : getHelped().getHosts()) { stopHostApplications(host); } }
public static void main(String[] args) { Component component = new Component(); component.getServers().add(Protocol.HTTP, 8080); (...) component.start(); }
@Override public synchronized void start() throws Exception { boolean success = checkVirtualHost(getHelped().getDefaultHost()); for (VirtualHost host : getHelped().getHosts()) { success = success && checkVirtualHost(host); getHelped().stop(); } else { Filter filter = null; for (Service service : getHelped().getServices()) { if (service.isEnabled()) { : getContext().createChildContext()); : getContext().createChildContext());
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); httpServer.getContext().getParameters().addAll(sslConfiguration); restletComponent.start();
var component = new Component(); component = null; // delete this at next garbage collection
final Component component = new Component(); component.getClients().add(Protocol.CLAP); final Directory dir = new Directory(component.getContext(), "clap://class/META-INF/resources/webjars"); dir.setDeeplyAccessible(true); this.attach("/webjars", dir); //access via http://example.com/webjars/jquery/1.9.0/jquery.min.js
/** * 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); }
component.getInternalRouter().handle(request, response); } else if (cr.getRiapAuthorityType() == LocalReference.RIAP_HOST) { VirtualHost host = null; .getHosts().iterator(); (host == null) && hostIter.hasNext();) { currentHost = hostIter.next(); if ((host == null) && (component.getDefaultHost() != null)) { if (component.getDefaultHost().hashCode() == hostHashCode) { host = component.getDefaultHost();
for (final VirtualHost vh : component.getHosts()) { if (vh.getHostDomain().equals(hostDomain) && vh.getHostPort().equals(hostPort) host = new VirtualHost(component.getContext().createChildContext()); host.setHostDomain(hostDomain); host.setHostPort(hostPort); host.setHostScheme(hostScheme); component.getHosts().add(host);
Component c = new Component(); Client client = c.getClients().add(Protocol.HTTP); client.getContext().getParameters().add ( "parameter", "value" );