本文整理了Java中org.apache.catalina.startup.Tomcat.getConnector()
方法的一些代码示例,展示了Tomcat.getConnector()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tomcat.getConnector()
方法的具体详情如下:
包路径:org.apache.catalina.startup.Tomcat
类名称:Tomcat
方法名:getConnector
[英]Get the default http connector. You can set more parameters - the port is already initialized. Alternatively, you can construct a Connector and set any params, then call addConnector(Connector)
[中]获取默认的http连接器。您可以设置更多参数-端口已初始化。或者,您可以构造一个连接器并设置任何参数,然后调用addConnector(连接器)
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public int getPort() {
Connector connector = this.tomcat.getConnector();
if (connector != null) {
return connector.getLocalPort();
}
return 0;
}
代码示例来源:origin: apache/incubator-dubbo
tomcat.setBaseDir(baseDir);
tomcat.setPort(url.getPort());
tomcat.getConnector().setProperty(
"maxThreads", String.valueOf(url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS)));
tomcat.getConnector().setProperty(
"maxConnections", String.valueOf(url.getParameter(Constants.ACCEPTS_KEY, -1)));
tomcat.getConnector().setProperty("URIEncoding", "UTF-8");
tomcat.getConnector().setProperty("connectionTimeout", "60000");
tomcat.getConnector().setProperty("maxKeepAliveRequests", "-1");
tomcat.getConnector().setProtocol("org.apache.coyote.http11.Http11NioProtocol");
代码示例来源:origin: apache/incubator-dubbo
tomcat.setBaseDir(baseDir);
tomcat.setPort(url.getPort());
tomcat.getConnector().setProperty(
"maxThreads", String.valueOf(url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS)));
tomcat.getConnector().setProperty(
"maxConnections", String.valueOf(url.getParameter(Constants.ACCEPTS_KEY, -1)));
tomcat.getConnector().setProperty("URIEncoding", "UTF-8");
tomcat.getConnector().setProperty("connectionTimeout", "60000");
tomcat.getConnector().setProperty("maxKeepAliveRequests", "-1");
tomcat.getConnector().setProtocol("org.apache.coyote.http11.Http11NioProtocol");
代码示例来源:origin: apache/usergrid
public static void main(String[] args) throws Exception {
String webappsPath = args[0];
int port = Integer.parseInt( args[1] );
File dataDir = Files.createTempDir();
dataDir.deleteOnExit();
Tomcat tomcat = new Tomcat();
tomcat.setBaseDir(dataDir.getAbsolutePath());
tomcat.setPort(port);
tomcat.getConnector().setAttribute("maxThreads", "1000");
tomcat.addWebapp("/", new File(webappsPath).getAbsolutePath());
logger.info("-----------------------------------------------------------------");
logger.info("Starting Tomcat port {} dir {}", port, webappsPath);
logger.info("-----------------------------------------------------------------");
tomcat.start();
while ( true ) {
Thread.sleep(1000);
}
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void start() throws Exception {
this.tomcatServer.start();
this.port = this.tomcatServer.getConnector().getLocalPort();
this.context.addLifecycleListener(event -> {
if (logger.isDebugEnabled()) {
logger.debug("Event: " + event.getType());
}
});
}
代码示例来源:origin: spring-projects/spring-framework
@Override
protected void startInternal() throws LifecycleException {
this.tomcatServer.start();
setPort(this.tomcatServer.getConnector().getLocalPort());
}
代码示例来源:origin: org.springframework.boot/spring-boot
private void checkThatConnectorsHaveStarted() {
checkConnectorHasStarted(this.tomcat.getConnector());
for (Connector connector : this.tomcat.getService().findConnectors()) {
checkConnectorHasStarted(connector);
}
}
代码示例来源:origin: org.springframework.boot/spring-boot
Connector connector = this.tomcat.getConnector();
if (connector != null && this.autoStart) {
performDeferredLoadOnStartup();
代码示例来源:origin: AsyncHttpClient/async-http-client
ctx.addServletMappingDecoded("/*", "webdav");
tomcat.start();
port1 = tomcat.getConnector().getLocalPort();
代码示例来源:origin: AsyncHttpClient/async-http-client
ctx.addServletMappingDecoded("/*", "webdav");
tomcat.start();
port1 = tomcat.getConnector().getLocalPort();
代码示例来源:origin: line/armeria
@Override
protected void configure(ServerBuilder sb) throws Exception {
// Prepare Tomcat instances.
tomcatWithWebApp = new Tomcat();
tomcatWithWebApp.setPort(0);
tomcatWithWebApp.setBaseDir("build" + File.separatorChar +
"tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-1");
tomcatWithWebApp.addWebapp("", WebAppContainerTest.webAppRoot().getAbsolutePath());
TomcatUtil.engine(tomcatWithWebApp.getService(), "foo").setName("tomcatWithWebApp");
tomcatWithoutWebApp = new Tomcat();
tomcatWithoutWebApp.setPort(0);
tomcatWithoutWebApp.setBaseDir("build" + File.separatorChar +
"tomcat-" + UnmanagedTomcatServiceTest.class.getSimpleName() + "-2");
assertThat(TomcatUtil.engine(tomcatWithoutWebApp.getService(), "bar")).isNotNull();
// Start the Tomcats.
tomcatWithWebApp.start();
tomcatWithoutWebApp.start();
// Bind them to the Server.
sb.serviceUnder("/empty/", TomcatService.forConnector("someHost", new Connector()))
.serviceUnder("/some-webapp-nohostname/",
TomcatService.forConnector(tomcatWithWebApp.getConnector()))
.serviceUnder("/no-webapp/", TomcatService.forTomcat(tomcatWithoutWebApp))
.serviceUnder("/some-webapp/", TomcatService.forTomcat(tomcatWithWebApp));
}
};
代码示例来源:origin: spring-projects/spring-integration
public String getWsBaseUrl() {
return "ws://localhost:" + this.tomcatServer.getConnector().getLocalPort();
}
代码示例来源:origin: spring-projects/spring-restdocs
@Override
protected void before() throws LifecycleException {
this.tomcat = new Tomcat();
this.tomcat.getConnector().setPort(0);
Context context = this.tomcat.addContext("/", null);
this.tomcat.addServlet("/", "test", new TestServlet());
context.addServletMappingDecoded("/", "test");
this.tomcat.addServlet("/", "set-cookie", new CookiesServlet());
context.addServletMappingDecoded("/set-cookie", "set-cookie");
this.tomcat.start();
this.port = this.tomcat.getConnector().getLocalPort();
}
代码示例来源:origin: org.crazyyak.dev/yak-dev-embedded-tomcat
private void configureDefaultConnector(int port, int securePort) {
System.out.println("Creating default connector on port " + port);
tomcat.setPort(port);
if (securePort > 0) {
tomcat.getConnector().setRedirectPort(securePort);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* Initialise the server.
*
* @throws LifecycleException
*/
public void init() throws LifecycleException {
getServer();
getConnector();
server.init();
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
/**
* Initialise the server.
*
* @throws LifecycleException
*/
public void init() throws LifecycleException {
getServer();
getConnector();
server.init();
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
/**
* Initialise the server.
*
* @throws LifecycleException
*/
public void init() throws LifecycleException {
getServer();
getConnector();
server.init();
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
/**
* Start the server.
*
* @throws LifecycleException
*/
public void start() throws LifecycleException {
getServer();
getConnector();
server.start();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
/**
* Initialise the server.
*
* @throws LifecycleException
*/
public void init() throws LifecycleException {
getServer();
getConnector();
server.init();
}
代码示例来源:origin: pippo-java/pippo
private void enableSSLConnector(Tomcat tomcat) {
log.info("Using https protocol");
Connector connector = tomcat.getConnector();
connector.setPort(getSettings().getPort());
connector.setSecure(true);
connector.setScheme("https");
connector.setAttribute("keyAlias", getSettings().getKeyAlias());
connector.setAttribute("keystorePass", getSettings().getKeystorePassword());
connector.setAttribute("keystoreType", getSettings().getKeyType());
connector.setAttribute("keystoreFile", getSettings().getKeystoreFile());
connector.setAttribute("clientAuth", getSettings().getClientAuth());
if (getSettings().getClientAuth()) {
connector.setAttribute("truststoreFile", getSettings().getTruststoreFile());
connector.setAttribute("truststorePass", getSettings().getTruststorePassword());
}
connector.setAttribute("protocol", "HTTP/1.1");
connector.setAttribute("sslProtocol", "TLS");
connector.setAttribute("maxThreads", getSettings().getMaxConnections());
connector.setAttribute("protocol", "org.apache.coyote.http11.Http11AprProtocol");
connector.setAttribute("SSLEnabled", true);
}
内容来源于网络,如有侵权,请联系作者删除!