本文整理匯總了Java中org.springframework.boot.autoconfigure.web.ServerProperties類的典型用法代碼示例。如果您正苦於以下問題:Java ServerProperties類的具體用法?Java ServerProperties怎麽用?Java ServerProperties使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ServerProperties類屬於org.springframework.boot.autoconfigure.web包,在下文中一共展示了ServerProperties類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: customize
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (this.managementServerProperties == null) {
this.managementServerProperties = BeanFactoryUtils
.beanOfTypeIncludingAncestors(this.beanFactory,
ManagementServerProperties.class);
this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
this.beanFactory, ServerProperties.class);
}
// Customize as per the parent context first (so e.g. the access logs go to
// the same place)
this.server.customize(container);
// Then reset the error pages
container.setErrorPages(Collections.<ErrorPage>emptySet());
// and the context path
container.setContextPath("");
// and add the management-specific bits
container.setPort(this.managementServerProperties.getPort());
if (this.managementServerProperties.getSsl() != null) {
container.setSsl(this.managementServerProperties.getSsl());
}
container.setServerHeader(this.server.getServerHeader());
container.setAddress(this.managementServerProperties.getAddress());
container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:26,代碼來源:EndpointWebMvcChildContextConfiguration.java
示例2: purgeAccessLogCustomizer
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
/**
* Purge access log customizer embedded servlet container customizer.
*
* @param serverProperties the server properties
* @param purgeProperties the purge properties
* @return the embedded servlet container customizer
*/
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
final ServerProperties serverProperties,
final PurgeProperties purgeProperties) {
return container -> {
final UndertowEmbeddedServletContainerFactory factory = (UndertowEmbeddedServletContainerFactory)
container;
final Undertow.Accesslog accesslog = serverProperties.getUndertow()
.getAccesslog();
final UndertowPurgeAccessLogHolder accessLogHolder = new UndertowPurgeAccessLogHolder(
purgeProperties, accesslog.getDir().toPath(),
accesslog.getPrefix(), accesslog.getSuffix());
factory.addDeploymentInfoCustomizers(accessLogHolder);
};
}
開發者ID:marcosbarbero,項目名稱:spring-boot-starter-purge-accesslog,代碼行數:23,代碼來源:PurgeAccessLogAutoConfiguration.java
示例3: servletContainerCustomizer
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的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));
}
});
}
};
}
示例4: RequestForwarder
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public RequestForwarder(
ServerProperties server,
CharonProperties charon,
HttpClientProvider httpClientProvider,
MappingsProvider mappingsProvider,
LoadBalancer loadBalancer,
MetricRegistry metricRegistry,
TraceInterceptor traceInterceptor
) {
this.server = server;
this.charon = charon;
this.httpClientProvider = httpClientProvider;
this.mappingsProvider = mappingsProvider;
this.loadBalancer = loadBalancer;
this.metricRegistry = metricRegistry;
this.traceInterceptor = traceInterceptor;
}
示例5: getRequestMatcher
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public static RequestMatcher getRequestMatcher(
ManagementContextResolver contextResolver) {
if (contextResolver == null) {
return null;
}
ManagementServerProperties management = contextResolver
.getApplicationContext().getBean(ManagementServerProperties.class);
ServerProperties server = contextResolver.getApplicationContext()
.getBean(ServerProperties.class);
String path = management.getContextPath();
if (StringUtils.hasText(path)) {
AntPathRequestMatcher matcher = new AntPathRequestMatcher(
server.getPath(path) + "/**");
return matcher;
}
// Match everything, including the sensitive and non-sensitive paths
return new LazyEndpointPathRequestMatcher(contextResolver, EndpointPaths.ALL);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:19,代碼來源:ManagementWebSecurityAutoConfiguration.java
示例6: get
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public static ManagementServerPort get(Environment environment,
BeanFactory beanFactory) {
Integer serverPort = getPortProperty(environment, "server.");
if (serverPort == null && hasCustomBeanDefinition(beanFactory,
ServerProperties.class, ServerPropertiesAutoConfiguration.class)) {
serverPort = getTemporaryBean(beanFactory, ServerProperties.class)
.getPort();
}
Integer managementPort = getPortProperty(environment, "management.");
if (managementPort == null && hasCustomBeanDefinition(beanFactory,
ManagementServerProperties.class,
ManagementServerPropertiesAutoConfiguration.class)) {
managementPort = getTemporaryBean(beanFactory,
ManagementServerProperties.class).getPort();
}
if (managementPort != null && managementPort < 0) {
return DISABLE;
}
return ((managementPort == null)
|| (serverPort == null && managementPort.equals(8080))
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
: DIFFERENT);
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:24,代碼來源:EndpointWebMvcAutoConfiguration.java
示例7: overrideServerProperties
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Test
public void overrideServerProperties() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"server.displayName:foo");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
ServerProperties serverProperties = this.applicationContext
.getBean(ServerProperties.class);
assertThat(serverProperties.getDisplayName()).isEqualTo("foo");
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:19,代碼來源:EndpointWebMvcAutoConfigurationTests.java
示例8: customize
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (this.managementServerProperties == null) {
this.managementServerProperties = BeanFactoryUtils
.beanOfTypeIncludingAncestors(this.beanFactory,
ManagementServerProperties.class);
this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
this.beanFactory, ServerProperties.class);
}
// Customize as per the parent context first (so e.g. the access logs go to
// the same place)
this.server.customize(container);
// Then reset the error pages
container.setErrorPages(Collections.<ErrorPage>emptySet());
// and the context path
container.setContextPath("");
// and add the management-specific bits
container.setPort(this.managementServerProperties.getPort());
container.setServerHeader(this.server.getServerHeader());
container.setAddress(this.managementServerProperties.getAddress());
container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
示例9: customize
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (this.managementServerProperties == null) {
this.managementServerProperties = BeanFactoryUtils
.beanOfTypeIncludingAncestors(this.beanFactory,
ManagementServerProperties.class);
this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
this.beanFactory, ServerProperties.class);
}
// Customize as per the parent context first (so e.g. the access logs go to
// the same place)
this.server.customize(container);
// Then reset the error pages
container.setErrorPages(Collections.<ErrorPage>emptySet());
// and add the management-specific bits
container.setPort(this.managementServerProperties.getPort());
container.setAddress(this.managementServerProperties.getAddress());
container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
示例10: ServletFilterErrorHandler
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public ServletFilterErrorHandler(ErrorAttributes errorAttributes, ServerProperties serverProperties, ErrorsFactory errorsFactory, ErrorDataProviderContext providerContext) {
super(errorAttributes, emptyList());
this.errorAttributes = errorAttributes;
errorProperties = serverProperties.getError();
this.errorsFactory = errorsFactory;
this.providerContext = providerContext;
}
示例11: SampleController
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Autowired
public SampleController(ServerProperties serverProps, Environment environment) {
this.serverPort = serverProps.getPort();
String userIdHeaderKeysFromEnv = environment.getProperty("wingtips.user-id-header-keys");
this.userIdHeaderKeys = (userIdHeaderKeysFromEnv == null)
? null
: Arrays.asList(userIdHeaderKeysFromEnv.split(","));
}
示例12: MappingsProvider
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public MappingsProvider(
ServerProperties server,
CharonProperties charon,
MappingsCorrector mappingsCorrector,
HttpClientProvider httpClientProvider
) {
this.server = server;
this.charon = charon;
this.mappingsCorrector = mappingsCorrector;
this.httpClientProvider = httpClientProvider;
}
示例13: ConfigurationMappingsProvider
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
public ConfigurationMappingsProvider(
ServerProperties server,
CharonProperties charon,
MappingsCorrector mappingsCorrector,
HttpClientProvider httpClientProvider
) {
super(server, charon, mappingsCorrector, httpClientProvider);
}
示例14: createDelegate
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
private RequestMatcher createDelegate() {
ServerProperties server = this.contextResolver.getApplicationContext()
.getBean(ServerProperties.class);
List<RequestMatcher> matchers = new ArrayList<RequestMatcher>();
EndpointHandlerMapping endpointHandlerMapping = getRequiredEndpointHandlerMapping();
for (String path : this.endpointPaths.getPaths(endpointHandlerMapping)) {
matchers.add(new AntPathRequestMatcher(server.getPath(path)));
}
return (matchers.isEmpty() ? MATCH_NONE : new OrRequestMatcher(matchers));
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:ManagementWebSecurityAutoConfiguration.java
示例15: curieProvider
import org.springframework.boot.autoconfigure.web.ServerProperties; //導入依賴的package包/類
@Bean
@ConditionalOnBean(DocsMvcEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
ManagementServerProperties management, DocsMvcEndpoint endpoint) {
String path = management.getContextPath() + endpoint.getPath()
+ "/#spring_boot_actuator__{rel}";
if (server.getPort().equals(management.getPort()) && management.getPort() != 0) {
path = server.getPath(path);
}
return new DefaultCurieProvider("boot", new UriTemplate(path));
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:EndpointWebMvcHypermediaManagementContextConfiguration.java