當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。