本文整理汇总了Java中org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.setPort方法的典型用法代码示例。如果您正苦于以下问题:Java JettyEmbeddedServletContainerFactory.setPort方法的具体用法?Java JettyEmbeddedServletContainerFactory.setPort怎么用?Java JettyEmbeddedServletContainerFactory.setPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory
的用法示例。
在下文中一共展示了JettyEmbeddedServletContainerFactory.setPort方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jettyConfigBean
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
* @return Jetty config bean
*/
@Bean
public EmbeddedServletContainerFactory jettyConfigBean() {
JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory();
jef.setPort(getServerPort());
logger.info("Listening on port {}...", jef.getPort());
return jef;
}
示例2: servletContainer
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
// Port number that server will run.
factory.setPort(8888);
return factory;
}
示例3: containerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory containerFactory() {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
factory.setPort(3000);
return factory;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:ServerPropertiesAutoConfigurationTests.java
示例4: servletContainerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainerFactory() {
JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory = new JettyEmbeddedServletContainerFactory();
jettyEmbeddedServletContainerFactory.setPort(0);
return jettyEmbeddedServletContainerFactory;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:WebSocketAutoConfigurationTests.java
示例5: servletContainer
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
factory.setPort(8081);
return factory;
}
示例6: jettyConfigBean
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入方法依赖的package包/类
/**
* @return Jetty config bean
*/
@Bean
public EmbeddedServletContainerFactory jettyConfigBean() {
JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory();
jef.addServerCustomizers(new JettyServerCustomizer() {
public void customize(Server server) {
if (Config.getConfigBoolean("access_log_enabled", true)) {
// enable access log via Logback
HandlerCollection handlers = new HandlerCollection();
for (Handler handler : server.getHandlers()) {
handlers.addHandler(handler);
}
RequestLogHandler reqLogs = new RequestLogHandler();
reqLogs.setServer(server);
RequestLogImpl rli = new RequestLogImpl();
rli.setResource("/logback-access.xml");
rli.setQuiet(true);
rli.start();
reqLogs.setRequestLog(rli);
handlers.addHandler(reqLogs);
server.setHandler(handlers);
}
for (Connector y : server.getConnectors()) {
for (ConnectionFactory cf : y.getConnectionFactories()) {
if (cf instanceof HttpConnectionFactory) {
HttpConnectionFactory dcf = (HttpConnectionFactory) cf;
// support for X-Forwarded-Proto
// redirect back to https if original request uses it
if (Config.IN_PRODUCTION) {
HttpConfiguration httpConfiguration = dcf.getHttpConfiguration();
httpConfiguration.addCustomizer(new ForwardedRequestCustomizer());
}
// Disable Jetty version header
dcf.getHttpConfiguration().setSendServerVersion(false);
}
}
}
}
});
int defaultPort = NumberUtils.toInt(System.getProperty("jetty.http.port", "8080"));
jef.setPort(NumberUtils.toInt(System.getProperty("server.port"), defaultPort));
logger.info("Listening on port {}...", jef.getPort());
return jef;
}