本文整理汇总了Java中org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer类的典型用法代码示例。如果您正苦于以下问题:Java UndertowDeploymentInfoCustomizer类的具体用法?Java UndertowDeploymentInfoCustomizer怎么用?Java UndertowDeploymentInfoCustomizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UndertowDeploymentInfoCustomizer类属于org.springframework.boot.context.embedded.undertow包,在下文中一共展示了UndertowDeploymentInfoCustomizer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: embeddedServletContainerFactory
import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer; //导入依赖的package包/类
@Bean
public UndertowEmbeddedServletContainerFactory
embeddedServletContainerFactory(
ConfigProvider<UndertowConfig> cfg) {
int port = cfg.defaultReadConfig().findFirst().get().getPort();
UndertowEmbeddedServletContainerFactory factory =
new UndertowEmbeddedServletContainerFactory(port);
factory.addBuilderCustomizers((UndertowBuilderCustomizer) builder -> { // (*)
builder.setServerOption(UndertowOptions.DECODE_URL, true);
builder.setServerOption(UndertowOptions.URL_CHARSET,
StandardCharsets.UTF_8.name());
});
factory.addDeploymentInfoCustomizers(
(UndertowDeploymentInfoCustomizer) deployment -> { // (*)
deployment.setDefaultEncoding(StandardCharsets.UTF_8.name());
});
return factory;
}
示例2: enableAuthUDICustomizer
import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer; //导入依赖的package包/类
private UndertowDeploymentInfoCustomizer enableAuthUDICustomizer() {
return (DeploymentInfo di) -> {
if(StringUtils.isEmpty(encodedPass)) {
return;
}
SecurityConstraint sc = new SecurityConstraint();
sc.setEmptyRoleSemantic(SecurityInfo.EmptyRoleSemantic.AUTHENTICATE);
// empty web resource interpret as default
sc.addWebResourceCollection(new WebResourceCollection());
di.addSecurityConstraints(sc);
di.setSecurityDisabled(false);
di.setAuthenticationMode(AuthenticationMode.PRO_ACTIVE);
di.setLoginConfig(new LoginConfig(HttpServletRequest.BASIC_AUTH, "Haven Agent"));
di.setIdentityManager(new IdentityManagerImpl(encodedPass));
};
}
示例3: embeddedServletContainerFactory
import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer; //导入依赖的package包/类
@Bean
@Autowired
public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory(List<UndertowDeploymentInfoCustomizer> customizers) {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
for (UndertowDeploymentInfoCustomizer customizer : customizers) {
factory.addDeploymentInfoCustomizers(customizer);
}
return factory;
}
示例4: servletContainer
import org.springframework.boot.context.embedded.undertow.UndertowDeploymentInfoCustomizer; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerFactory servletContainer() {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
factory.addDeploymentInfoCustomizers(new UndertowDeploymentInfoCustomizer() {
@Override
public void customize(DeploymentInfo deploymentInfo) {
deploymentInfo.addInitialHandlerChainWrapper(new RootHandlerWrapper());
}
});
factory.setPort(Integer.parseInt(environment.getProperty("shiny.proxy.port", "8080")));
return factory;
}