本文整理了Java中org.restlet.routing.VirtualHost.<init>()
方法的一些代码示例,展示了VirtualHost.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VirtualHost.<init>()
方法的具体详情如下:
包路径:org.restlet.routing.VirtualHost
类名称:VirtualHost
方法名:<init>
[英]Constructor. Note that usage of this constructor is not recommended as the virtual host won't have a proper context set. In general you will prefer to use the other constructor and pass it the parent component's context.
[中]建造师。请注意,不建议使用此构造函数,因为虚拟主机没有正确的上下文集。通常,您会更喜欢使用另一个构造函数,并将其传递给父组件的上下文。
代码示例来源:origin: stackoverflow.com
Component c = new Component();
c.getServers().add(Protocol.HTTP, 8182);
VirtualHost host = new VirtualHost();
host.setHostDomain("localhost");
c.getHosts().add(host);
host.attach(new Restlet() {
@Override
public void handle(Request request, Response response) {
response.setEntity("hello, world", MediaType.TEXT_PLAIN);
}
});
c.start();
代码示例来源:origin: stackoverflow.com
try {
VirtualHost virtualHost = getExistingVirtualHost(
component, hostDomain, hostPort);
if (virtualHost == null) {
virtualHost = new VirtualHost();
virtualHost.setHostDomain(hostDomain);
virtualHost.setHostPort(hostPort);
component.getHosts().add(virtualHost);
}
Context context = component.getContext().createChildContext();
virtualHost.setContext(context);
virtualHost.attachDefault(application);
component.updateHosts();
application.start();
} catch(Exception ex) {
(...)
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
host = new VirtualHost(component.getContext().createChildContext());
host.setHostDomain(hostDomain);
host.setHostPort(hostPort);
代码示例来源:origin: org.restlet.osgi/org.restlet
parseHost(getComponent().getDefaultHost(), childNode);
} else if ("host".equals(childNode.getNodeName())) {
final VirtualHost host = new VirtualHost(getComponent()
.getContext());
parseHost(host, childNode);
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* 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);
}
}
内容来源于网络,如有侵权,请联系作者删除!