org.restlet.routing.VirtualHost.attach()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中org.restlet.routing.VirtualHost.attach()方法的一些代码示例,展示了VirtualHost.attach()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VirtualHost.attach()方法的具体详情如下:
包路径:org.restlet.routing.VirtualHost
类名称:VirtualHost
方法名:attach

VirtualHost.attach介绍

[英]Attaches a target Restlet to this router based on a given URI pattern. A new route will be added routing to the target when calls with a URI matching the pattern will be received. In addition to super class behavior, this method will set the context of the target if it is empty by creating a protected context via the Context#createChildContext() method.
[中]基于给定的URI模式将目标Restlet附加到此路由器。当接收到URI与模式匹配的呼叫时,将向目标添加新路由。除了超类行为之外,如果目标为空,该方法还将通过context#createChildContext()方法创建受保护的上下文来设置该目标的上下文。

代码示例

代码示例来源:origin: uber/chaperone

_component.getDefaultHost().attach(_controllerRestApp);

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  // Create a new Restlet component and add a HTTP server connector to it
  Component component = new Component();
  component.getServers().add(Protocol.HTTP, 8111);
  // Then attach it to the local host
  component.getDefaultHost().attach("/trace",
      Part05_RestletComponents.class);
  // Now, let's start the component!
  // Note that the HTTP server connector is also automatically started.
  component.start();
}

代码示例来源:origin: cdelmas/microservices-comparison

@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());
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  // Create a new Component.
  Component component = new Component();
  // Add a new HTTP server listening on port 8111.
  component.getServers().add(Protocol.HTTP, 8111);
  component.getDefaultHost().attach("/firstResource",
      new FirstResourceApplication());
  // Start the component.
  component.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  Component c = new Component();
  c.getServers().add(Protocol.HTTP, 8182);
  c.getDefaultHost().attach(new QueryRouterApplication());
  c.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  // Create a new Component.
  Component component = new Component();
  // Add a new HTTP server listening on port 8111.
  component.getServers().add(Protocol.HTTP, 8111);
  component.getDefaultHost().attach("/firstResource",
      new FirstResourceApplication());
  // Start the component.
  component.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  Component c = new Component();
  c.getServers().add(Protocol.HTTP, 8182);
  c.getDefaultHost().attach(new FileUploadApplication());
  c.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
    // Create a new Component.
    Component component = new Component();

    // Add a new HTTP server listening on port 8111.
    component.getServers().add(Protocol.HTTP, 8111);

    // Attach the sample application.
    component.getDefaultHost().attach("/firstSteps",
        new FirstStepsApplication());

    // Start the component.
    component.start();
  }
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

/**
 * 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();
  mailServer.getServers().add(Protocol.HTTP, 8111);
  mailServer.getDefaultHost().attach(new MailServerApplication());
  mailServer.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

/**
 * 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();
  mailServer.getServers().add(Protocol.HTTP, 8111);
  mailServer.getDefaultHost().attach(new MailServerApplication());
  mailServer.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

/**
 * 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();
  mailServer.getServers().add(Protocol.HTTP, 8111);
  mailServer.getDefaultHost().attach(new MailServerApplication());
  mailServer.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

/**
 * 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();
  mailServer.getServers().add(Protocol.HTTP, 8111);
  mailServer.getDefaultHost().attach(new MailServerApplication());
  mailServer.start();
}

代码示例来源:origin: gofore/aws-training

public void start() throws Exception {
  Injector injector = RestletGuice.createInjector(modules);
  Application instance = injector.getInstance(application);
  Component component = new Component();
  component.getServers().add(Protocol.HTTP, port);
  component.getClients().add(Protocol.FILE);
  component.getClients().add(Protocol.CLAP);
  component.getDefaultHost().attach(instance);
  component.start();
}

代码示例来源:origin: paulnguyen/cmpe202

public static void main(String[] args) throws Exception {
  Component server = new Component() ;
  server.getServers().add(Protocol.HTTP, 8080) ;
  server.getDefaultHost().attach(new CartServer()) ;
  server.start() ;
  CartAPI.generateOrders() ;
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  Component c = new Component();
  // server listening on pport 8182
  c.getServers().add(Protocol.HTTP, 8182);
  // client connector required by the Directory.
  c.getClients().add(Protocol.FILE);
  c.getDefaultHost().attach(new AuthenticationApplication());
  c.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  Component component = new Component();
  component.getServers().add(Protocol.HTTP, 8111);
  component.getClients().add(Protocol.FILE);
  component.getDefaultHost().attach(new MergeSitesServicesApplication());
  component.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
  Component c = new Component();
  // server listening on pport 8182
  c.getServers().add(Protocol.HTTP, 8182);
  // client connector required by the Directory.
  c.getClients().add(Protocol.FILE);
  c.getDefaultHost().attach(new HttpDigestAuthenticationApplication());
  c.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String[] args) throws Exception {
    // Setup Restlet
    Component component = new Component();
    component.getClients().add(Protocol.HTTP);
    component.getClients().add(Protocol.HTTPS);
    component.getServers().add(Protocol.HTTP, 8888);

    component.getDefaultHost().attach("/sample", new SampleApplication());

    component.start();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void startServer()
  throws Exception
{
  configuration.refresh();
  component = new Component();
  component.getServers().add( Protocol.HTTP, configuration.get().port().get() );
  RestApplication application = module.newObject( RestApplication.class, component.getContext() );
  component.getDefaultHost().attach( application );
  component.start();
}

代码示例来源:origin: org.restlet.jse/org.restlet.example

public static void main(String... args) throws Exception {
  // Create a component with an HTTP server connector
  final Component component = new Component();
  component.getServers().add(Protocol.HTTP, 8585);
  component.getClients().add(Protocol.FILE);
  component.getClients().add(Protocol.CLAP);
  component.getClients().add(Protocol.HTTP);
  // Attach the application to the default host and start it
  component.getDefaultHost().attach("/foaf", new Application());
  component.start();
}

相关文章