本文整理汇总了Java中io.undertow.servlet.api.ServletContainer类的典型用法代码示例。如果您正苦于以下问题:Java ServletContainer类的具体用法?Java ServletContainer怎么用?Java ServletContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServletContainer类属于io.undertow.servlet.api包,在下文中一共展示了ServletContainer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initServlet
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
private static void initServlet() throws ServletException, NoSuchMethodException {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
DeploymentInfo deploymentInfo = new DeploymentInfo()
.addListener(Servlets.listener(WeldInitialListener.class))
.addListener(Servlets.listener(WeldTerminalListener.class))
.setContextPath("/")
.setDeploymentName("standalone-javax-mvc-app")
.addServlet(
createServletInfo("/resources/*", "JAX-RS Resources", org.glassfish.jersey.servlet.ServletContainer.class)
)
.setResourceManager(new ClassPathResourceManager(classLoader, "META-INF/webapp"))
.setClassIntrospecter(CdiClassIntrospecter.INSTANCE)
.setAllowNonStandardWrappers(true)
.setClassLoader(classLoader);
ServletContainer servletContainer = Servlets.defaultContainer();
DeploymentManager deploymentManager = servletContainer.addDeployment(deploymentInfo);
deploymentManager.deploy();
Undertow server = Undertow.builder()
.addHttpListener(8080, "0.0.0.0")
.setHandler(deploymentManager.start())
.build();
server.start();
}
开发者ID:shamoh,项目名称:standalone-javax-mvc,代码行数:26,代码来源:Main.java
示例2: deployLogs
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
protected void deployLogs(BootContext context, ServletContainer servletContainer) {
String adminLogs = context.properties().getProperty("vas.admin.logs", "false");
if(Boolean.valueOf(adminLogs)) {
DeploymentInfo deploymentInfo = Servlets
.deployment()
.setContextPath("/")
.setDeploymentName("logback.war")
.setClassLoader(getClass().getClassLoader())
.addServlet(
Servlets.servlet("logback", ViewStatusMessagesServlet.class).setEnabled(true).setAsyncSupported(true)
.setLoadOnStartup(1).addMappings("/"));
DeploymentManager deploymentManager = servletContainer.addDeployment(deploymentInfo);
deploymentManager.deploy();
try {
context.pathHandler().addPrefixPath("/admin/logs", deploymentManager.start());
} catch (ServletException e) {
throw new RuntimeException(e);
}
}
}
开发者ID:vvergnolle,项目名称:vas,代码行数:23,代码来源:AdminHttpHandlerPostProcessor.java
示例3: init
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
private void init(PathHandler pathHandler) throws ServletException {
// Deployment info
ServletContainer servletContainer = Servlets.defaultContainer();
DeploymentInfo deploymentInfo = VasHelper.deploymentInfo();
// Boot context & post processors
context = new BootContextImpl(properties, pathHandler, deploymentInfo, services);
VasHelper.lookupHandlerPostProcessors(context);
// Deployment
DeploymentManager deploymentManager = servletContainer.addDeployment(deploymentInfo);
deploymentManager.deploy();
pathHandler.addPrefixPath(Const.CONTEXT_NAME, deploymentManager.start());
boot();
}
开发者ID:vvergnolle,项目名称:vas,代码行数:17,代码来源:VasImpl.java
示例4: mountServerEndpoints
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
protected PathHandler mountServerEndpoints(final PathHandler pathHandler , List<Class<?>> serverEndpoints) throws ServletException{
if(!serverEndpoints.isEmpty()){
DeploymentInfo builder = new DeploymentInfo()
.setClassLoader(this.getClass().getClassLoader())
.setContextPath("/");
WebSocketDeploymentInfo wsDeployInfo = new WebSocketDeploymentInfo();
wsDeployInfo.setBuffers(new ByteBufferSlicePool(100, 1000));
for(Class<?> serverEndpoint : serverEndpoints ){
wsDeployInfo.addEndpoint( serverEndpoint );
}
builder.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, wsDeployInfo );
builder.setDeploymentName("websocketDeploy.war");
final ServletContainer container = ServletContainer.Factory.newInstance();
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
pathHandler.addPrefixPath("/", manager.start() );
}
return pathHandler;
}
开发者ID:EsmerilProgramming,项目名称:overtown,代码行数:21,代码来源:PathHandlerMounter.java
示例5: ServletContextImpl
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
public ServletContextImpl(final ServletContainer servletContainer, final Deployment deployment) {
this.servletContainer = servletContainer;
this.deployment = deployment;
this.deploymentInfo = deployment.getDeploymentInfo();
sessionCookieConfig = new SessionCookieConfigImpl(this);
sessionCookieConfig.setPath(deploymentInfo.getContextPath());
if (deploymentInfo.getServletContextAttributeBackingMap() == null) {
this.attributes = new ConcurrentHashMap<>();
} else {
this.attributes = deploymentInfo.getServletContextAttributeBackingMap();
}
attributes.putAll(deployment.getDeploymentInfo().getServletContextAttributes());
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:ServletContextImpl.java
示例6: defaultContainer
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
/**
* Returns the default servlet container. For most embedded use
* cases this will be sufficient.
*
* @return The default servlet container
*/
public static ServletContainer defaultContainer() {
if (container != null) {
return container;
}
synchronized (Servlets.class) {
if (container != null) {
return container;
}
return container = ServletContainer.Factory.newInstance();
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:Servlets.java
示例7: DeploymentImpl
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
public DeploymentImpl(DeploymentManager deploymentManager, final DeploymentInfo deploymentInfo, ServletContainer servletContainer) {
this.deploymentManager = deploymentManager;
this.deploymentInfo = deploymentInfo;
this.servletContainer = servletContainer;
this.executor = deploymentInfo.getExecutor();
this.asyncExecutor = deploymentInfo.getAsyncExecutor();
servletPaths = new ServletPathMatches(this);
servlets = new ManagedServlets(this, servletPaths);
filters = new ManagedFilters(this, servletPaths);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:DeploymentImpl.java
示例8: postProcess
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
@Override
public void postProcess(BootContext context) {
ServletContainer servletContainer = Servlets.defaultContainer();
deployLogs(context, servletContainer);
deployJaxrs(context);
}
开发者ID:vvergnolle,项目名称:vas,代码行数:8,代码来源:AdminHttpHandlerPostProcessor.java
示例9: createRootHandler
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
public HttpHandler createRootHandler(Configuration configuration , ScannerResult scannerResult) {
PathHandler pathHandler = Handlers.path();
String appContext = "/" + configuration.getAppContext();
pathHandler.addPrefixPath( appContext , createAppHandlers(scannerResult));
if(!scannerResult.getServerEndpoints().isEmpty()){
DeploymentInfo builder = new DeploymentInfo().setClassLoader(this.getClass().getClassLoader()).setContextPath("/");
WebSocketDeploymentInfo wsDeployInfo = new WebSocketDeploymentInfo();
wsDeployInfo.setBuffers(new ByteBufferSlicePool(100, 1000));
for(Class<?> serverEndpoint : scannerResult.getServerEndpoints() ){
wsDeployInfo.addEndpoint( serverEndpoint );
}
builder.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, wsDeployInfo);
builder.setDeploymentName("websocketDeploy.war");
final ServletContainer container = ServletContainer.Factory.newInstance();
DeploymentManager manager = container.addDeployment(builder);
manager.deploy();
try {
OvertownSessionManager sessionManager = OvertownSessionManager.getInstance();
String wsContextPath = "ws";
if( !appContext.endsWith("/") ){
wsContextPath += appContext + "/" + wsContextPath;
}
pathHandler.addPrefixPath( wsContextPath ,
new SessionAttachmentHandler( manager.start() , sessionManager.getSessionManager(),
sessionManager.getSessionConfig()) );
} catch (ServletException e) {
e.printStackTrace();
}
}
String staticContextPath = configuration.getStaticRootPath();
if( !appContext.endsWith("/") ){
staticContextPath = appContext + "/" + staticContextPath;
}
pathHandler.addPrefixPath( staticContextPath , new ResourceHandlerMounter().mount());
return pathHandler;
}
开发者ID:EsmerilProgramming,项目名称:overtown,代码行数:39,代码来源:StartupHandlerImpl.java
示例10: getServletContainer
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
public ServletContainer getServletContainer() {
return servletContainer;
}
开发者ID:yangfuhai,项目名称:jboot,代码行数:4,代码来源:UnderTowServer.java
示例11: getServletContainer
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
@Override
public ServletContainer getServletContainer() {
return servletContainer;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:DeploymentImpl.java
示例12: DeploymentManagerImpl
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
public DeploymentManagerImpl(final DeploymentInfo deployment, final ServletContainer servletContainer) {
this.originalDeployment = deployment;
this.servletContainer = servletContainer;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:DeploymentManagerImpl.java
示例13: getServletContainerFromNewFactory
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
private ServletContainer getServletContainerFromNewFactory() {
UndertowEmbeddedServletContainer undertow1 = (UndertowEmbeddedServletContainer) getFactory()
.getEmbeddedServletContainer();
return ((DeploymentManager) ReflectionTestUtils.getField(undertow1, "manager"))
.getDeployment().getServletContainer();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:UndertowEmbeddedServletContainerFactoryTests.java
示例14: newContainer
import io.undertow.servlet.api.ServletContainer; //导入依赖的package包/类
/**
* Creates a new servlet container.
*
* @return A new servlet container
*/
public static ServletContainer newContainer() {
return new ServletContainerImpl();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:Servlets.java
注:本文中的io.undertow.servlet.api.ServletContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论