本文整理了Java中org.eclipse.jetty.server.Server.setConnectors()
方法的一些代码示例,展示了Server.setConnectors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.setConnectors()
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Server
类名称:Server
方法名:setConnectors
[英]Set the connectors for this server. Each connector has this server set as it's ThreadPool and its Handler.
[中]设置此服务器的连接器。每个连接器都将此服务器设置为其线程池及其处理程序。
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
protected void doStart() throws Exception {
for (Connector connector : JettyWebServer.this.connectors) {
Assert.state(connector.isStopped(), () -> "Connector "
+ connector + " has been started prematurely");
}
JettyWebServer.this.server.setConnectors(null);
}
代码示例来源:origin: org.springframework.boot/spring-boot
private Server createServer(InetSocketAddress address) {
Server server = new Server(getThreadPool());
server.setConnectors(new Connector[] { createConnector(address, server) });
return server;
}
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public void customize(Server server) {
SslContextFactory sslContextFactory = new SslContextFactory();
configureSsl(sslContextFactory, this.ssl, this.sslStoreProvider);
ServerConnector connector = createConnector(server, sslContextFactory,
this.address);
server.setConnectors(new Connector[] { connector });
}
代码示例来源:origin: openzipkin/brave
protected Server newServer(int port) {
Server result = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setPort(port);
result.setConnectors(new Connector[] {connector});
return result;
}
代码示例来源:origin: perwendel/spark
server = connector.getServer();
if (previousConnectors.length != 0) {
server.setConnectors(previousConnectors);
hasCustomizedConnectors = true;
} else {
server.setConnectors(new Connector[] {connector});
代码示例来源:origin: google/data-transfer-project
new HttpConnectionFactory(https));
sslConnector.setPort(httpPort);
server.setConnectors(new Connector[] {sslConnector});
} else {
server = new Server(httpPort);
new ServerConnector(server, new HttpConnectionFactory(new HttpConfiguration()));
connector.setPort(httpPort);
server.setConnectors(new Connector[] {connector});
代码示例来源:origin: json-path/JsonPath
public static void main(String[] args) throws Exception {
String configPort = "8080";
if(args.length > 0){
configPort = args[0];
}
String port = System.getProperty("server.http.port", configPort);
System.out.println("Server started on port: " + port);
Server server = new Server();
server.setConnectors(new Connector[]{createConnector(server, Integer.parseInt(port))});
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
context.setContextPath("/api");
ServletHolder servletHolder = new ServletHolder(createJerseyServlet());
servletHolder.setInitOrder(1);
context.addServlet(servletHolder, "/*");
WebAppContext webAppContext = new WebAppContext();
webAppContext.setServer(server);
webAppContext.setContextPath("/");
String resourceBase = System.getProperty("resourceBase");
if(resourceBase != null){
webAppContext.setResourceBase(resourceBase);
} else {
webAppContext.setResourceBase(Main.class.getResource("/webapp").toExternalForm());
}
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]{context, webAppContext});
server.setHandler(handlers);
server.start();
server.join();
}
代码示例来源:origin: stackoverflow.com
connector.setSoLingerTime(-1);
connector.setPort(8080);
server.setConnectors(new Connector[] { connector });
代码示例来源:origin: jersey/jersey
new HttpConnectionFactory(config));
https.setPort(port);
server.setConnectors(new Connector[]{https});
server.setConnectors(new Connector[]{http});
代码示例来源:origin: DeemOpen/zkui
server.setConnectors(new Connector[]{https});
} else {
if(globalProps.getProperty("X-Forwarded-For").equals("true")) {
server.setConnectors(new Connector[]{http});
代码示例来源:origin: pentaho/pentaho-kettle
private void createListeners() {
SocketConnector connector = getConnector();
setupJettyOptions( connector );
connector.setPort( port );
connector.setHost( hostname );
connector.setName( BaseMessages.getString( PKG, "WebServer.Log.KettleHTTPListener", hostname ) );
log.logBasic( BaseMessages.getString( PKG, "WebServer.Log.CreateListener", hostname, "" + port ) );
server.setConnectors( new Connector[] { connector } );
}
代码示例来源:origin: apache/geode
httpServer.setConnectors(new Connector[] {connector});
代码示例来源:origin: apache/nifi
server.setConnectors(new Connector[]{http});
} else {
server.setConnectors(new Connector[]{https});
代码示例来源:origin: org.springframework.boot/spring-boot
return;
this.server.setConnectors(this.connectors);
if (!this.autoStart) {
return;
代码示例来源:origin: apache/nifi
server.setConnectors(new Connector[] {connector});
代码示例来源:origin: apache/incubator-druid
server.setConnectors(new Connector[]{sslConnector});
server.start();
代码示例来源:origin: apache/incubator-druid
server.setConnectors(connectors);
final long gracefulStop = config.getGracefulShutdownTimeout().toStandardDuration().getMillis();
if (gracefulStop > 0) {
代码示例来源:origin: apache/nifi
server.setConnectors(new Connector[] {serverConnector});
代码示例来源:origin: pippo-java/pippo
@Override
public void start() {
server = createServer();
ServerConnector serverConnector = createServerConnector(server);
serverConnector.setIdleTimeout(TimeUnit.HOURS.toMillis(1));
serverConnector.setSoLingerTime(-1);
serverConnector.setHost(getSettings().getHost());
serverConnector.setPort(getSettings().getPort());
ServerConnector[] connectors = new ServerConnector[1];
connectors[0] = serverConnector;
server.setConnectors(connectors);
Handler pippoHandler = createPippoHandler();
server.setHandler(pippoHandler);
String version = server.getClass().getPackage().getImplementationVersion();
log.info("Starting Jetty Server {} on port {}", version, getSettings().getPort());
try {
server.start();
} catch (Exception e) {
log.error("Unable to launch Jetty", e);
throw new PippoRuntimeException(e);
}
}
代码示例来源:origin: rhuss/jolokia
/**
* Get the agent server for suing it with mule
*
* @param pConfig agent configuration
* @return the server
*/
protected Server getServer(MuleAgentConfig pConfig) {
Server newServer = new Server();
Connector connector = createConnector(newServer);
if (pConfig.getHost() != null) {
ClassUtil.applyMethod(connector, "setHost", pConfig.getHost());
}
ClassUtil.applyMethod(connector,"setPort",pConfig.getPort());
newServer.setConnectors(new Connector[]{connector});
return newServer;
}
内容来源于网络,如有侵权,请联系作者删除!