当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentInfo类代码示例

本文整理汇总了Java中io.undertow.servlet.api.DeploymentInfo的典型用法代码示例。如果您正苦于以下问题:Java DeploymentInfo类的具体用法?Java DeploymentInfo怎么用?Java DeploymentInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DeploymentInfo类属于io.undertow.servlet.api包,在下文中一共展示了DeploymentInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customize

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Override
public void customize(DeploymentInfo deploymentInfo) {
    deploymentInfo.addInitialHandlerChainWrapper(handler -> {
            return Handlers.path()
                .addPrefixPath("/", handler)
                .addPrefixPath(path, new ServerSentEventHandler(new EventBusHandler()){
                    @Override
                    @SuppressWarnings("PMD.SignatureDeclareThrowsException")
                    public void handleRequest(HttpServerExchange exchange) throws Exception {
                        if( reservationCheck(exchange) ) {
                            super.handleRequest(exchange);
                        }
                    }
                });
        }
    );
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:18,代码来源:EventBusToServerSentEvents.java

示例2: deploymentInfo

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Test
public void deploymentInfo() throws Exception {
	UndertowEmbeddedServletContainerFactory factory = getFactory();
	UndertowDeploymentInfoCustomizer[] customizers = new UndertowDeploymentInfoCustomizer[4];
	for (int i = 0; i < customizers.length; i++) {
		customizers[i] = mock(UndertowDeploymentInfoCustomizer.class);
	}
	factory.setDeploymentInfoCustomizers(
			Arrays.asList(customizers[0], customizers[1]));
	factory.addDeploymentInfoCustomizers(customizers[2], customizers[3]);
	this.container = factory.getEmbeddedServletContainer();
	InOrder ordered = inOrder((Object[]) customizers);
	for (UndertowDeploymentInfoCustomizer customizer : customizers) {
		ordered.verify(customizer).customize((DeploymentInfo) anyObject());
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:UndertowEmbeddedServletContainerFactoryTests.java

示例3: initializeErrorPages

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
private void initializeErrorPages(final DeploymentImpl deployment, final DeploymentInfo deploymentInfo) {
    final Map<Integer, String> codes = new HashMap<>();
    final Map<Class<? extends Throwable>, String> exceptions = new HashMap<>();
    String defaultErrorPage = null;
    for (final ErrorPage page : deploymentInfo.getErrorPages()) {
        if (page.getExceptionType() != null) {
            exceptions.put(page.getExceptionType(), page.getLocation());
        } else if (page.getErrorCode() != null) {
            codes.put(page.getErrorCode(), page.getLocation());
        } else {
            if (defaultErrorPage != null) {
                throw UndertowServletMessages.MESSAGES.moreThanOneDefaultErrorPage(defaultErrorPage, page.getLocation());
            } else {
                defaultErrorPage = page.getLocation();
            }
        }
    }
    deployment.setErrorPages(new ErrorPages(codes, exceptions, defaultErrorPage));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:DeploymentManagerImpl.java

示例4: handleDeploymentSessionConfig

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
public void handleDeploymentSessionConfig(DeploymentInfo deploymentInfo, ServletContextImpl servletContext) {
    SessionCookieConfigImpl sessionCookieConfig = servletContext.getSessionCookieConfig();
    ServletSessionConfig sc = deploymentInfo.getServletSessionConfig();
    if (sc != null) {
        sessionCookieConfig.setName(sc.getName());
        sessionCookieConfig.setComment(sc.getComment());
        sessionCookieConfig.setDomain(sc.getDomain());
        sessionCookieConfig.setHttpOnly(sc.isHttpOnly());
        sessionCookieConfig.setMaxAge(sc.getMaxAge());
        if(sc.getPath() != null) {
            sessionCookieConfig.setPath(sc.getPath());
        } else {
            sessionCookieConfig.setPath(deploymentInfo.getContextPath());
        }
        sessionCookieConfig.setSecure(sc.isSecure());
        if (sc.getSessionTrackingModes() != null) {
            servletContext.setDefaultSessionTrackingModes(new HashSet<>(sc.getSessionTrackingModes()));
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:DeploymentManagerImpl.java

示例5: customize

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Override
public void customize(final DeploymentInfo di) {
	AccessController.doPrivileged(new PrivilegedAction<Void>() {
		@Override
		public Void run() {
			ClassLoader jsfClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
			di.setClassLoader(jsfClassLoader);

			di.setResourceManager(new ClassPathResourceManager(
				jsfClassLoader, JsfUndertowDeploymentInfoCustomizer.this.undertowProperties.getClassPathResource()));

			return null;
		}
	});

	log.info("Setting Undertow classLoader to {} directory", this.undertowProperties.getClassPathResource());
}
 
开发者ID:joinfaces,项目名称:joinfaces,代码行数:18,代码来源:JsfUndertowDeploymentInfoCustomizer.java

示例6: deploymentInfo

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
private static DeploymentInfo deploymentInfo(Config cfg) {
    return Servlets.deployment()
            .setDeploymentName(DEPLOYMENT_NAME)
            .setContextPath(CONTEXT_PATH)
            .setClassLoader(Server.class.getClassLoader())
            .setIgnoreFlush(cfg.getBoolean(KEY_IGNORE_FLUSH))
            .setDefaultEncoding(cfg.getString(KEY_DEFAULT_ENCODING))
            .setDefaultSessionTimeout(sessionTimeout(cfg))
            .setChangeSessionIdOnLogin(cfg.getBoolean(KEY_CHANGE_SESSIONID_ON_LOGIN))
            .setInvalidateSessionOnLogout(cfg.getBoolean(KEY_INVALIDATE_SESSION_ON_LOGOUT))
            .setIdentityManager(new SimpleIdentityManager(cfg))
            .setUseCachedAuthenticationMechanism(cfg.getBoolean(KEY_USE_CACHED_AUTH_MECHANISM))
            .setLoginConfig(Servlets.loginConfig(FORM_AUTH, REALM, TOOLS_LOGIN_URI, TOOLS_LOGIN_URI))
            .addServletContainerInitalizer(sciInfo())
            .addSecurityConstraint(securityConstraint(cfg))
            .addServlets(servlets())
            .addErrorPages(errorPages(cfg))
            .setDefaultMultipartConfig(defaultMultipartConfig(cfg))
            .addInitialHandlerChainWrapper(new ServletInitialHandlerWrapper())
            .addServletContextAttribute(ATTRIBUTE_NAME, webSocketDeploymentInfo(cfg))
            .setServletSessionConfig(sessionConfig(cfg));
}
 
开发者ID:AdeptJ,项目名称:adeptj-runtime,代码行数:23,代码来源:Server.java

示例7: handleDeployment

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Override
public void handleDeployment(DeploymentInfo info, ServletContext context) {
    info.addThreadSetupAction(new KeycloakThreadSetupHandler());

    info.addInnerHandlerChainWrapper(next -> exchange -> {
        KeycloakSecurityContext c = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY);
        if (c != null) {
            KeycloakSecurityContextAssociation.associate(c);
        }
        try {
            next.handleRequest(exchange);
        } finally {
            KeycloakSecurityContextAssociation.disassociate();
        }
    });
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:17,代码来源:SecurityContextServletExtension.java

示例8: customize

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Override
public void customize(DeploymentInfo deploymentInfo) {
    deploymentInfo.addInitialHandlerChainWrapper(handler -> {
            return Handlers.path()
                .addPrefixPath("/", handler)
                .addPrefixPath(path, new WebSocketProtocolHandshakeHandler(new WSHandler()) {
                    @Override
                    @SuppressWarnings("PMD.SignatureDeclareThrowsException")
                    public void handleRequest(HttpServerExchange exchange) throws Exception {
                        if (reservationCheck(exchange)) {
                            super.handleRequest(exchange);
                        }
                    }
                });
        }
    );
}
 
开发者ID:syndesisio,项目名称:syndesis-rest,代码行数:18,代码来源:EventBusToWebSocket.java

示例9: initServlet

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的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

示例10: createHtmlManager

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
private static HttpHandler createHtmlManager() throws ServletException {
    final DeploymentInfo deploymentInfo = Servlets.deployment()
            .setClassLoader(HttpServerUtil.class.getClassLoader())
            .setContextPath(SERVLET_CONTEXT_PATH)
            .setDeploymentName("uaiMockServer.war")
            .addServlets(
                    servlet("UaiIndexServlet", UaiIndexServlet.class).addMapping("/index"),
                    servlet("UaiPageServlet", UaiPageServlet.class).addMapping("/page"),
                    servlet("JavascriptServlet", UaiJavascriptServlet.class).addMapping("/javascript"),
                    servlet("CssServlet", UaiCssServlet.class).addMapping("/css"),
                    servlet("CssMapServlet", UaiCssMapServlet.class).addMapping("/bootstrap.css.map"),
                    servlet("AngularMapServlet", UAiAngularMapServlet.class).addMapping("/angular.js.map"),
                    servlet("UaiRouteServlet", UaiRouteServlet.class).addMapping("/uaiRoute"),
                    servlet("UaiRouteCloneServlet", UaiRouteCloneServlet.class).addMapping("/uaiRoute/clone"),
                    servlet("UaiRootConfigurationsServlet", UaiRootConfigurationsServlet.class).addMapping("/rootConfigurations")
            );

    final DeploymentManager manager = Servlets.defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();

    return manager.start();
}
 
开发者ID:uaihebert,项目名称:uaiMockServer,代码行数:23,代码来源:PathHandlerFactory.java

示例11: undertowDeployment

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
static DeploymentInfo undertowDeployment(ResteasyDeployment deployment, String mapping) {
    if (mapping == null) {
        mapping = "/";
    }

    if (!mapping.startsWith("/")) {
        mapping = '/' + mapping;
    }

    if (!mapping.endsWith("/")) {
        mapping = mapping + '/';
    }

    mapping = mapping + '*';
    String prefix = null;
    if (!mapping.equals("/*")) {
        prefix = mapping.substring(0, mapping.length() - 2);
    }

    ServletInfo resteasyServlet = Servlets.servlet("ResteasyServlet", HttpServlet30Dispatcher.class).setAsyncSupported(true).setLoadOnStartup(1).addMapping(mapping);
    if (prefix != null) {
        resteasyServlet.addInitParam("resteasy.servlet.mapping.prefix", prefix);
    }

    return (new DeploymentInfo()).addServletContextAttribute(ResteasyDeployment.class.getName(), deployment).addServlet(resteasyServlet);
}
 
开发者ID:automenta,项目名称:spimedb,代码行数:27,代码来源:WebServer.java

示例12: deployLogs

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的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

示例13: postProcess

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
@Override
public void postProcess(BootContext context) {
  boolean statelessAuth = statelessAuth(context);
  DeploymentInfo deploymentInfo = context.deploymentInfo();

  deploymentInfo.addAuthenticationMechanism(RestAuthenticationMechanism.MECHANISM_NAME, (name, formParserFactory,
    properties) -> new RestAuthenticationMechanism(statelessAuth, context.getService(UserRepository.class)));

  LoginConfig loginConfig = new LoginConfig(RestAuthenticationMechanism.MECHANISM_NAME, "vas-db-realm");
  deploymentInfo.setLoginConfig(loginConfig);

  deploymentInfo.setIdentityManager(context.getService(IdentityManager.class));
  deploymentInfo.addSecurityConstraint(new SecurityConstraint().addRoleAllowed(User.ROLE).addWebResourceCollection(
    new WebResourceCollection().addUrlPattern("/*")));

  logoutServlet(context, deploymentInfo);
}
 
开发者ID:vvergnolle,项目名称:vas,代码行数:18,代码来源:AuthHttpHandlerPostProcessor.java

示例14: init

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的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

示例15: setUpClass

import io.undertow.servlet.api.DeploymentInfo; //导入依赖的package包/类
/**
 * Sets up the test environment, generates data to upload, starts an
 * Undertow instance which will receive the client requests.
 * @throws Exception If an error occurred with the servlets
 */
@BeforeClass
public static void setUpClass() throws Exception {
    DeploymentInfo servletBuilder = Servlets.deployment()
            .setClassLoader(UndertowIntegrationTest.class.getClassLoader())
            .setContextPath("/")
            .setDeploymentName("ROOT.war")
            .addServlets(
                    Servlets.servlet("AsyncUploadServlet", AsyncUploadServlet.class)
                            .addMapping("/async")
                            .setAsyncSupported(true),
                    Servlets.servlet("BlockingUploadServlet", BlockingUploadServlet.class)
                            .addMapping("/blocking")
                            .setAsyncSupported(false)
            );

    DeploymentManager manager = Servlets.defaultContainer().addDeployment(servletBuilder);
    manager.deploy();
    PathHandler path = Handlers.path(Handlers.redirect("/")).addPrefixPath("/", manager.start());

    server = Undertow.builder()
            .addHttpListener(8080, "localhost")
            .setHandler(path)
            .build();
    server.start();
}
 
开发者ID:Elopteryx,项目名称:upload-parser,代码行数:31,代码来源:UndertowIntegrationTest.java


注:本文中的io.undertow.servlet.api.DeploymentInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。