本文整理匯總了Java中org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.setPort方法的典型用法代碼示例。如果您正苦於以下問題:Java TomcatEmbeddedServletContainerFactory.setPort方法的具體用法?Java TomcatEmbeddedServletContainerFactory.setPort怎麽用?Java TomcatEmbeddedServletContainerFactory.setPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
的用法示例。
在下文中一共展示了TomcatEmbeddedServletContainerFactory.setPort方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: embeddedServletContainerCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = (TomcatEmbeddedServletContainerFactory) container;
RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
List<RedisSessionHandlerValve> valves =
new ArrayList<RedisSessionHandlerValve>();
valves.add(0, valve);
tomcatEmbeddedServletContainerFactory.setContextValves(valves);
tomcatEmbeddedServletContainerFactory.setPort(28080); // Set the port of embeded tomcat as 28080 for default.
System.out.println("Enterring EmbeddedServletContainerCustomizer.customize()...");
tomcatEmbeddedServletContainerFactory.addContextCustomizers(
new ServletContainerCustomizer());
}
}
};
}
示例2: embeddedServletContainerCustomizer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Value("${application.port}")
private int embeddedServletContainerListenPort;
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (container instanceof TomcatEmbeddedServletContainerFactory) {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory =
(TomcatEmbeddedServletContainerFactory) container;
if (embeddedServletContainerListenPort <= 1024 || embeddedServletContainerListenPort > 65535) {
throw new IllegalArgumentException("The value of \"application.port\" in the properties file is invalid.");
}
tomcatEmbeddedServletContainerFactory.setPort(embeddedServletContainerListenPort);
}
}
};
}
示例3: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory();
// tomcatFactory.setAddress(InetAddress.getLocalHost());// you can restrict localhost access
tomcatFactory.setPort(8080);
// ServletContainerInitializer
final Connector connector = new Connector();
connector.setPort(8443);
connector.setSecure(true);
connector.setScheme("https");
connector.setProperty("SSLEnabled", "true");
connector.setProperty("keystorePass", "spring");
try {
final ClassPathResource classPathResource = new ClassPathResource("keystore");
System.err.println(classPathResource.getFile().getAbsolutePath());
connector.setProperty("keystoreFile", classPathResource.getFile().getAbsolutePath());
} catch (final Exception e) {
System.err.println("Error while loading classpath resource " + e.getMessage());
}
tomcatFactory.addAdditionalTomcatConnectors(connector);
return tomcatFactory;
}
示例4: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
/**
* 定製方法二:注入EmbeddedServletContainerFactory
* @return
*/
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(8083);
factory.setSessionTimeout(10, TimeUnit.MINUTES);
//優先級高於配置在/static/error文件夾裏麵的404.html頁麵
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/403.html"));
return factory;
}
示例5: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(80);
factory.setContextPath("/jersey");
factory.setSessionTimeout(60, TimeUnit.MINUTES);
return factory;
}
示例6: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(80);
factory.setContextPath("/liquid");
factory.setSessionTimeout(60, TimeUnit.MINUTES);
return factory;
}
示例7: containerFactory
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public TomcatEmbeddedServletContainerFactory containerFactory() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(SocketUtils.findAvailableTcpPort(40000));
return factory;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:PublicMetricsAutoConfigurationTests.java
示例8: containerFactory
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public TomcatEmbeddedServletContainerFactory containerFactory() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(0);
return factory;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:SecurityFilterAutoConfigurationEarlyInitializationTests.java
示例9: servletContainerFactory
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainerFactory() {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
tomcatEmbeddedServletContainerFactory.setPort(0);
return tomcatEmbeddedServletContainerFactory;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:WebSocketAutoConfigurationTests.java
示例10: embeddedServletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory embeddedServletContainer() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(this.port);
return factory;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:SpringApplicationIntegrationTestTests.java
示例11: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(11000);
return factory;
}
示例12: servletContainer
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; //導入方法依賴的package包/類
@Bean
public EmbeddedServletContainerFactory servletContainer() {
final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.setPort(22000);
return factory;
}