本文整理汇总了Java中org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory类的典型用法代码示例。如果您正苦于以下问题:Java JettyEmbeddedServletContainerFactory类的具体用法?Java JettyEmbeddedServletContainerFactory怎么用?Java JettyEmbeddedServletContainerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JettyEmbeddedServletContainerFactory类属于org.springframework.boot.context.embedded.jetty包,在下文中一共展示了JettyEmbeddedServletContainerFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: jettyEmbeddedServletContainerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
/**
* Configures the embedded jetty server. The values are configured in
* <b>application.yaml</b> file.
*
* @param port jetty server port
* @param maxThreads thread pool min thread
* @param minThreads thread pool max thread
* @param idleTimeout maximum thread idle time
* @param jmxEnabled true, if jetty jmx is enabled.
* @return {@link JettyEmbeddedServletContainerFactory}
*/
@Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(@Value("${server.port:8443}") final int port,
@Value("${jetty.thread-pool.max-threads:200}") final int maxThreads,
@Value("${jetty.thread-pool.min-threads:8}") final int minThreads,
@Value("${jetty.thread-pool.idle-timeout:60000}") final int idleTimeout,
@Value("${jetty.jmx.enabled:true}") final boolean jmxEnabled) {
log.info("Configuring Jetty server.");
final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(port);
factory.addServerCustomizers(server -> {
final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class);
threadPool.setMinThreads(minThreads);
threadPool.setMaxThreads(maxThreads);
threadPool.setIdleTimeout(idleTimeout);
log.info("Server thread pool config: " + server.getThreadPool());
// Jetty JMX config.
if (jmxEnabled) {
log.info("Exposing Jetty managed beans to the JMX platform server.");
server.addBean(new MBeanContainer(ManagementFactory.getPlatformMBeanServer()));
}
});
return factory;
}
开发者ID:oneops,项目名称:secrets-proxy,代码行数:34,代码来源:EmbeddedServerConfig.java
示例2: jettyConfigBean
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory jettyConfigBean() {
DynamicPropertyFactory propertyFactory = DynamicPropertyFactory.getInstance();
String accessLogFilePath = propertyFactory.getStringProperty("server.accessLog.config.file", ACCESS_LOG_FILE_PATH).getValue();
JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory
= new JettyEmbeddedServletContainerFactory();
jettyEmbeddedServletContainerFactory.addServerCustomizers(new org.springframework.boot.context.embedded.jetty.JettyServerCustomizer() {
public void customize(Server server) {
HandlerCollection handlers = new HandlerCollection();
for (Handler handler : server.getHandlers()) {
handlers.addHandler(handler);
}
RequestLogHandler requestLogHandler = new RequestLogHandler();
RequestLogImpl requestLogImpl = new RequestLogImpl();
requestLogImpl.setFileName(accessLogFilePath);
requestLogHandler.setRequestLog(requestLogImpl);
handlers.addHandler(requestLogHandler);
server.setHandler(handlers);
LOGGER.info("Jetty Server Customized. Access Log Configuration File - {}", accessLogFilePath);
}
});
return jettyEmbeddedServletContainerFactory;
}
开发者ID:andrewharmellaw,项目名称:jetty-server-request-logger,代码行数:26,代码来源:JettyServerCustomizer.java
示例3: servletContainerCustomizer
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
@Autowired
public EmbeddedServletContainerCustomizer servletContainerCustomizer(ServerProperties properties) {
return container -> {
if (container instanceof JettyEmbeddedServletContainerFactory) {
JettyEmbeddedServletContainerFactory jettyContainer = (JettyEmbeddedServletContainerFactory) container;
jettyContainer.addConfigurations(new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
properties.getContextParameters().forEach((k, v) -> context.setInitParameter(k, v));
}
});
}
};
}
开发者ID:HeroXXiv,项目名称:Robocode,代码行数:17,代码来源:AppConfig.java
示例4: customizeJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
void customizeJetty(final ServerProperties serverProperties,
JettyEmbeddedServletContainerFactory factory) {
factory.setUseForwardHeaders(serverProperties.getOrDeduceUseForwardHeaders());
if (this.acceptors != null) {
factory.setAcceptors(this.acceptors);
}
if (this.selectors != null) {
factory.setSelectors(this.selectors);
}
if (serverProperties.getMaxHttpHeaderSize() > 0) {
customizeMaxHttpHeaderSize(factory,
serverProperties.getMaxHttpHeaderSize());
}
if (serverProperties.getMaxHttpPostSize() > 0) {
customizeMaxHttpPostSize(factory, serverProperties.getMaxHttpPostSize());
}
if (serverProperties.getConnectionTimeout() != null) {
customizeConnectionTimeout(factory,
serverProperties.getConnectionTimeout());
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:23,代码来源:ServerProperties.java
示例5: customizeConnectionTimeout
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
private void customizeConnectionTimeout(
JettyEmbeddedServletContainerFactory factory,
final int connectionTimeout) {
factory.addServerCustomizers(new JettyServerCustomizer() {
@Override
public void customize(Server server) {
for (org.eclipse.jetty.server.Connector connector : server
.getConnectors()) {
if (connector instanceof AbstractConnector) {
((AbstractConnector) connector)
.setIdleTimeout(connectionTimeout);
}
}
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:ServerProperties.java
示例6: customizeJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
void customizeJetty(ServerProperties serverProperties,
JettyEmbeddedServletContainerFactory factory) {
factory.setUseForwardHeaders(serverProperties.getOrDeduceUseForwardHeaders());
if (this.acceptors != null) {
factory.setAcceptors(this.acceptors);
}
if (this.selectors != null) {
factory.setSelectors(this.selectors);
}
if (serverProperties.getMaxHttpHeaderSize() > 0) {
customizeMaxHttpHeaderSize(factory,
serverProperties.getMaxHttpHeaderSize());
}
if (serverProperties.getMaxHttpPostSize() > 0) {
customizeMaxHttpPostSize(factory, serverProperties.getMaxHttpPostSize());
}
}
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:18,代码来源:ServerProperties.java
示例7: disableServerHeader
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer disableServerHeader() {
return container -> {
if (container instanceof JettyEmbeddedServletContainerFactory) {
((JettyEmbeddedServletContainerFactory) container).addServerCustomizers(new JettyServerCustomizer() {
@Override
public void customize(Server server) {
for (Connector connector : server.getConnectors()) {
if (connector instanceof ServerConnector) {
HttpConnectionFactory connectionFactory = connector.getConnectionFactory(HttpConnectionFactory.class);
connectionFactory.getHttpConfiguration().setSendServerVersion(false);
}
}
}
});
}
};
}
开发者ID:AusDTO,项目名称:citizenship-appointment-server,代码行数:19,代码来源:AppConfig.java
示例8: jettyEmbeddedServletContainerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(
@Value("${server.port:8080}") final String port,
@Value("${jetty.threadPool.maxThreads:200}") final String maxThreads,
@Value("${jetty.threadPool.minThreads:8}") final String minThreads,
@Value("${jetty.threadPool.idleTimeout:60000}") final String idleTimeout) {
final JettyEmbeddedServletContainerFactory factory =
new JettyEmbeddedServletContainerFactory(Integer.valueOf(port));
factory.addServerCustomizers((JettyServerCustomizer) server -> {
final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class);
threadPool.setMaxThreads(Integer.valueOf(maxThreads));
threadPool.setMinThreads(Integer.valueOf(minThreads));
threadPool.setIdleTimeout(Integer.valueOf(idleTimeout));
final GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setHandler(server.getHandler());
gzipHandler.setSyncFlush(true);
server.setHandler(gzipHandler);
});
return factory;
}
开发者ID:zalando,项目名称:nakadi,代码行数:22,代码来源:JettyConfig.java
示例9: addStatisticHandler
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
private void addStatisticHandler(JettyEmbeddedServletContainerFactory jetty) {
jetty.addServerCustomizers(server -> {
HandlerCollection handlerCollection = new HandlerCollection(server.getHandlers());
statisticsHandler.setHandler(handlerCollection);
server.setHandler(statisticsHandler);
});
}
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:8,代码来源:JettyMetricsCustomizer.java
示例10: customizeJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
void customizeJetty(JettyEmbeddedServletContainerFactory container) {
container.addServerCustomizers(server -> {
RequestLogHandler requestLogsHandler = new RequestLogHandler();
requestLogsHandler.setServer(server);
Slf4jRequestLog log = new Slf4jRequestLog();
requestLogsHandler.setRequestLog(log);
HandlerCollection handlers = new HandlerCollection(server.getHandlers());
handlers.prependHandler(requestLogsHandler);
server.setHandler(handlers);
});
}
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:14,代码来源:JettyAccessLogCustomizer.java
示例11: jettyCustomizer
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
public JettyCustomizer jettyCustomizer() {
return new JettyCustomizer() {
@Override
void customizeJetty(JettyEmbeddedServletContainerFactory container) {
String serverName = "jetty";
container.setServerHeader(serverName);
container.setDisplayName(serverName);
container.setUseForwardHeaders(true);
}
};
}
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:13,代码来源:JettyConfiguration.java
示例12: customizeJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
void customizeJetty(JettyEmbeddedServletContainerFactory container) {
container.addServerCustomizers(server -> {
MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addEventListener(mbContainer);
server.addBean(mbContainer);
});
}
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:9,代码来源:JettyJmxCustomizer.java
示例13: 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;
}
开发者ID:Erudika,项目名称:scoold,代码行数:11,代码来源:ScooldServer.java
示例14: containerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory containerFactory() {
JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(
0);
factory.setContextPath(this.env.getProperty("context"));
return factory;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:EmbeddedServletContainerMvcIntegrationTests.java
示例15: doCustomize
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
protected void doCustomize(JettyEmbeddedServletContainerFactory container) {
container.addConfigurations(new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
ServerContainer serverContainer = WebSocketServerContainerInitializer
.configureContext(context);
ShutdownThread.deregister(serverContainer);
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:JettyWebSocketContainerCustomizer.java
示例16: defaultUseForwardHeadersJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void defaultUseForwardHeadersJetty() throws Exception {
JettyEmbeddedServletContainerFactory container = spy(
new JettyEmbeddedServletContainerFactory());
this.properties.customize(container);
verify(container).setUseForwardHeaders(false);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:ServerPropertiesTests.java
示例17: setUseForwardHeadersJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void setUseForwardHeadersJetty() throws Exception {
this.properties.setUseForwardHeaders(true);
JettyEmbeddedServletContainerFactory container = spy(
new JettyEmbeddedServletContainerFactory());
this.properties.customize(container);
verify(container).setUseForwardHeaders(true);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:ServerPropertiesTests.java
示例18: deduceUseForwardHeadersJetty
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void deduceUseForwardHeadersJetty() throws Exception {
this.properties.setEnvironment(new MockEnvironment().withProperty("DYNO", "-"));
JettyEmbeddedServletContainerFactory container = spy(
new JettyEmbeddedServletContainerFactory());
this.properties.customize(container);
verify(container).setUseForwardHeaders(true);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:ServerPropertiesTests.java
示例19: sessionStoreDir
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void sessionStoreDir() throws Exception {
Map<String, String> map = new HashMap<String, String>();
map.put("server.session.store-dir", "myfolder");
bindProperties(map);
JettyEmbeddedServletContainerFactory container = spy(
new JettyEmbeddedServletContainerFactory());
this.properties.customize(container);
verify(container).setSessionStoreDir(new File("myfolder"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:ServerPropertiesTests.java
示例20: jettyEmbeddedServletContainerFactory
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; //导入依赖的package包/类
@Primary
@Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(MetricRegistry metricRegistry,
JettyThreadPoolSettings jettyThreadPoolSettings,
JettyLowResourceMonitorSettings jettyLowResourceMonitorSettings,
@Value("${server.port:8080}") final int port) {
final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(port);
factory.addServerCustomizers(
new InstrumentedJettyServer(metricRegistry, jettyThreadPoolSettings, jettyLowResourceMonitorSettings));
return factory;
}
开发者ID:fastnsilver,项目名称:xlator,代码行数:12,代码来源:JettyConfig.java
注:本文中的org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论