本文整理汇总了Java中org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory类的典型用法代码示例。如果您正苦于以下问题:Java AbstractEmbeddedServletContainerFactory类的具体用法?Java AbstractEmbeddedServletContainerFactory怎么用?Java AbstractEmbeddedServletContainerFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractEmbeddedServletContainerFactory类属于org.springframework.boot.context.embedded包,在下文中一共展示了AbstractEmbeddedServletContainerFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addConnector
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
protected void addConnector(int port,
AbstractEmbeddedServletContainerFactory factory) {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(port);
((TomcatEmbeddedServletContainerFactory) factory)
.addAdditionalTomcatConnectors(connector);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:TomcatEmbeddedServletContainerFactoryTests.java
示例2: errorPage404
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void errorPage404() throws Exception {
AbstractEmbeddedServletContainerFactory factory = getFactory();
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/hello"));
this.container = factory.getEmbeddedServletContainer(
new ServletRegistrationBean(new ExampleServlet(), "/hello"));
this.container.start();
assertThat(getResponse(getLocalUrl("/hello"))).isEqualTo("Hello World");
assertThat(getResponse(getLocalUrl("/not-found"))).isEqualTo("Hello World");
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:UndertowEmbeddedServletContainerFactoryTests.java
示例3: addConnector
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
protected void addConnector(final int port,
AbstractEmbeddedServletContainerFactory factory) {
((UndertowEmbeddedServletContainerFactory) factory)
.addBuilderCustomizers(new UndertowBuilderCustomizer() {
@Override
public void customize(Builder builder) {
builder.addHttpListener(port, "0.0.0.0");
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:UndertowEmbeddedServletContainerFactoryTests.java
示例4: addConnector
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
protected void addConnector(final int port,
AbstractEmbeddedServletContainerFactory factory) {
((JettyEmbeddedServletContainerFactory) factory)
.addServerCustomizers(new JettyServerCustomizer() {
@Override
public void customize(Server server) {
ServerConnector connector = new ServerConnector(server);
connector.setPort(port);
server.addConnector(connector);
}
});
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:JettyEmbeddedServletContainerFactoryTests.java
示例5: setUpFactoryForCompression
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Override
@SuppressWarnings("serial")
// Workaround for Jetty issue - https://bugs.eclipse.org/bugs/show_bug.cgi?id=470646
protected String setUpFactoryForCompression(final int contentSize, String[] mimeTypes,
String[] excludedUserAgents) throws Exception {
char[] chars = new char[contentSize];
Arrays.fill(chars, 'F');
final String testContent = new String(chars);
AbstractEmbeddedServletContainerFactory factory = getFactory();
Compression compression = new Compression();
compression.setEnabled(true);
if (mimeTypes != null) {
compression.setMimeTypes(mimeTypes);
}
if (excludedUserAgents != null) {
compression.setExcludedUserAgents(excludedUserAgents);
}
factory.setCompression(compression);
this.container = factory.getEmbeddedServletContainer(
new ServletRegistrationBean(new HttpServlet() {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentLength(contentSize);
resp.setHeader(HttpHeaders.CONTENT_TYPE, "text/plain");
resp.getWriter().print(testContent);
}
}, "/test.txt"));
this.container.start();
return testContent;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:32,代码来源:JettyEmbeddedServletContainerFactoryTests.java
示例6: customizeWithJettyContainerFactory
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void customizeWithJettyContainerFactory() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(CustomJettyContainerConfig.class,
ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
containerFactory = this.context
.getBean(AbstractEmbeddedServletContainerFactory.class);
ServerProperties server = this.context.getBean(ServerProperties.class);
assertThat(server).isNotNull();
// The server.port environment property was not explicitly set so the container
// factory should take precedence...
assertThat(containerFactory.getPort()).isEqualTo(3000);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:ServerPropertiesAutoConfigurationTests.java
示例7: customizeWithUndertowContainerFactory
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void customizeWithUndertowContainerFactory() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(CustomUndertowContainerConfig.class,
ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
containerFactory = this.context
.getBean(AbstractEmbeddedServletContainerFactory.class);
ServerProperties server = this.context.getBean(ServerProperties.class);
assertThat(server).isNotNull();
assertThat(containerFactory.getPort()).isEqualTo(3000);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ServerPropertiesAutoConfigurationTests.java
示例8: errorPage404
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void errorPage404() throws Exception {
AbstractEmbeddedServletContainerFactory factory = getFactory();
factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/hello"));
this.container = factory.getEmbeddedServletContainer(
new ServletRegistrationBean(new ExampleServlet(), "/hello"));
this.container.start();
assertThat(getResponse(getLocalUrl("/hello")), equalTo("Hello World"));
assertThat(getResponse(getLocalUrl("/not-found")), equalTo("Hello World"));
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:UndertowEmbeddedServletContainerFactoryTests.java
示例9: customizeWithJettyContainerFactory
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void customizeWithJettyContainerFactory() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(CustomJettyContainerConfig.class,
ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
containerFactory = this.context
.getBean(AbstractEmbeddedServletContainerFactory.class);
ServerProperties server = this.context.getBean(ServerProperties.class);
assertNotNull(server);
// The server.port environment property was not explicitly set so the container
// factory should take precedence...
assertEquals(3000, containerFactory.getPort());
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:ServerPropertiesAutoConfigurationTests.java
示例10: customizeWithUndertowContainerFactory
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Test
public void customizeWithUndertowContainerFactory() throws Exception {
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
this.context.register(CustomUndertowContainerConfig.class,
ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
containerFactory = this.context
.getBean(AbstractEmbeddedServletContainerFactory.class);
ServerProperties server = this.context.getBean(ServerProperties.class);
assertNotNull(server);
assertEquals(3000, containerFactory.getPort());
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:14,代码来源:ServerPropertiesAutoConfigurationTests.java
示例11: init
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; //导入依赖的package包/类
@Before
public void init() {
containerFactory = mock(AbstractEmbeddedServletContainerFactory.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:ServerPropertiesAutoConfigurationTests.java
注:本文中的org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论