本文整理汇总了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;
}