當前位置: 首頁>>代碼示例>>Java>>正文


Java DeploymentManager類代碼示例

本文整理匯總了Java中io.undertow.servlet.api.DeploymentManager的典型用法代碼示例。如果您正苦於以下問題:Java DeploymentManager類的具體用法?Java DeploymentManager怎麽用?Java DeploymentManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DeploymentManager類屬於io.undertow.servlet.api包,在下文中一共展示了DeploymentManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDeploymentByPath

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
@Override
public DeploymentManager getDeploymentByPath(final String path) {

    DeploymentManager exact = deploymentsByPath.get(path.isEmpty() ? "/" : path);
    if (exact != null) {
        return exact;
    }
    int length = path.length();
    int pos = length;

    while (pos > 1) {
        --pos;
        if (path.charAt(pos) == '/') {
            String part = path.substring(0, pos);
            DeploymentManager deployment = deploymentsByPath.get(part);
            if (deployment != null) {
                return deployment;
            }
        }
    }
    return deploymentsByPath.get("/");
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:ServletContainerImpl.java

示例2: start

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public static void start(String[] args) throws ServletException {
    Map<String, String> commands = Arrays.stream(args)
            .map(cmd -> cmd.split(REGEX_EQ))
            .collect(toMap(cmdArray -> cmdArray[IDX_ZERO], cmdArray -> cmdArray[IDX_ONE]));
    Config undertowConf = Configs.DEFAULT.undertow();
    Config httpConf = undertowConf.getConfig(KEY_HTTP);
    Logger logger = LoggerFactory.getLogger(Server.class);
    logger.debug("Commands to AdeptJ Runtime: {}", commands);
    int httpPort = handlePortAvailability(httpConf, logger);
    logger.info("Starting AdeptJ Runtime @port: [{}]", httpPort);
    printBanner(logger);
    DeploymentManager manager = Servlets.defaultContainer().addDeployment(deploymentInfo(undertowConf));
    manager.deploy();
    Builder builder = Undertow.builder();
    optimizeWorkerOptions(builder, undertowConf, logger);
    ServerOptions.build(builder, undertowConf);
    builder.addHttpListener(httpPort, httpConf.getString(KEY_HOST));
    enableHttp2(undertowConf, builder, logger);
    enableAJP(undertowConf, builder, logger);
    GracefulShutdownHandler rootHandler = rootHandler(headersHandler(manager.start(), undertowConf), undertowConf);
    Undertow server = builder.setHandler(rootHandler).build();
    server.start();
    Runtime.getRuntime().addShutdownHook(new ShutdownHook(server, manager, rootHandler));
    launchBrowser(commands, httpPort, logger);
    if (!Environment.isServerConfFileExists()) {
        createServerConfFile(logger);
    }
}
 
開發者ID:AdeptJ,項目名稱:adeptj-runtime,代碼行數:29,代碼來源:Server.java

示例3: initServlet

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例4: createHtmlManager

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例5: main

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public static void main(String[] args) throws ServletException, IOException {
    final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader());
    final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap());
    final WebSocketDeploymentInfo webSockets = new WebSocketDeploymentInfo()
            .addEndpoint(SocketProxy.class)
            .setWorker(xnioWorker);
    final DeploymentManager deployment = defaultContainer()
            .addDeployment(deployment()
                    .setClassLoader(WebSocketServer.class.getClassLoader())
                    .setContextPath("/")
                    .setDeploymentName("embedded-websockets")
                    .addServletContextAttribute(ATTRIBUTE_NAME, webSockets));

    deployment.deploy();
    Undertow.builder().
            addListener(8080, "localhost")
            .setHandler(deployment.start())
            .setHandler(Handlers.path().addPrefixPath("/test", Handlers.resource(new ClassPathResourceManager(WebSocketServer.class.getClassLoader(), WebSocketServer.class.getPackage())).addWelcomeFiles("index.html")))
            .build()
            .start();

}
 
開發者ID:actframework,項目名稱:act-demo-apps,代碼行數:23,代碼來源:WebSocketServer.java

示例6: deployLogs

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例7: init

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例8: setUpClass

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例9: mountServerEndpoints

import io.undertow.servlet.api.DeploymentManager; //導入依賴的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

示例10: main

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public static void main(String[] args) throws IOException, ServletException {
    final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader());
    final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap());
    final WebSocketDeploymentInfo webSockets = new WebSocketDeploymentInfo()
            .addEndpoint(ClassProvider.class)
            .setWorker(xnioWorker);
    final DeploymentManager deploymentManager = Servlets.defaultContainer()
            .addDeployment(Servlets.deployment()
                    .setClassLoader(ClassProviderStarter.class.getClassLoader())
                    .setContextPath("/")
                    .setDeploymentName("class-provider")
                    .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSockets));

    deploymentManager.deploy();
    //noinspection deprecation
    Undertow.builder()
            .addListener(5000, "localhost")
            .setHandler(deploymentManager.start())
            .build()
            .start();
}
 
開發者ID:kawasima,項目名稱:websocket-classloader,代碼行數:22,代碼來源:ClassProviderStarter.java

示例11: deployApplications

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
/**
 * Setup the deployment managers for a given set of applications
 *
 * @param apps
 * @return list of deployment managers
 */
public List<DeploymentManager> deployApplications(List<Application> apps) {
	List<DeploymentManager> deployManagers = new ArrayList<DeploymentManager>();
	for (Application app : apps) {
		DeploymentInfo deployInfo = app.getDeploymentInfo();

		// Add default listeners
		ListenerInfo cdiListener = Servlets.listener(CdiServletRequestListener.class);
		deployInfo.addListener(cdiListener);

		DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(deployInfo);
		try {
			deploymentManager.deploy();
			deployManagers.add(deploymentManager);
		} catch (Exception e) {
			logger.log(Level.SEVERE, "stokesdrift:server:start[status=app_deploy_fail,app_type=" + app.getClass().getSimpleName() + "]", e);
		}
	}
	return deployManagers;
}
 
開發者ID:stokesdrift,項目名稱:stokesdrift,代碼行數:26,代碼來源:Server.java

示例12: start

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public void start() throws Exception {
	logger.log(Level.INFO, "stokesdrift:server:start[status=in_progress]");

	logger.log(Level.INFO, "stokesdrift:server:load_cdi_container[status=in_progress]");
	weld = new Weld();
	container = weld.initialize();
	logger.log(Level.INFO, "stokesdrift:server:load_cdi_container[status=complete]");

	applications = loadApplicationDefinitions(config);

	Undertow.Builder builder = Undertow.builder().addHttpListener(config.getPort(), config.getHost());
	List<DeploymentManager> managers = deployApplications(applications);
	for (DeploymentManager deploymentManager : managers) {
		builder.setHandler(deploymentManager.start());
	}
	server = builder.build();
	server.start();
	logger.log(Level.INFO, "stokesdrift:server:http[port="+config.getPort()+",host="+config.getHost()+"]");
	logger.log(Level.INFO, "stokesdrift:server:start[status=complete]");
}
 
開發者ID:stokesdrift,項目名稱:stokesdrift,代碼行數:21,代碼來源:Server.java

示例13: testUndertowLoading

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
@Test
public void testUndertowLoading() throws Exception {
	int port = 8888;
	FilterInfo filter = Servlets.filter("RackFilter", RackFilter.class);
	ListenerInfo listenerInfo = Servlets.listener(RackServletContextListener.class);
	DeploymentInfo di = new DeploymentInfo()
			.addListener(listenerInfo)
	        .setContextPath("/")
	        // .addInitParameter(name, value)
	        .addFilter(filter)
	        .addFilterUrlMapping("RackFilter", "/*", DispatcherType.ASYNC)
	        // .addServlet(servletInfo)
	        .setDeploymentName("RackServlet")
	        .setClassLoader(ClassLoader.getSystemClassLoader());
	DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(di);
	deploymentManager.deploy();
	Undertow server = Undertow.builder()
	        .addHttpListener(port, "localhost")
	        .setHandler(deploymentManager.start())
	        .build();
	Assert.assertNotNull(server);
	//	server.start();

}
 
開發者ID:stokesdrift,項目名稱:stokesdrift,代碼行數:25,代碼來源:UndertowTest.java

示例14: SimpleServletServer

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public SimpleServletServer() {
    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(SimpleServletServer.class.getClassLoader())
            .setContextPath("/helloworld")
            .setDeploymentName("helloworld.war")
            .addServlets(
                    Servlets.servlet("MyServlet", MyServlet.class)
                        .addInitParam("message", "Hello World")
                        .addMapping("/MyServlet"),
                    Servlets.servlet("MyAnotherServlet", MyAnotherServlet.class)
                        .addMapping("/MyAnotherServlet")
            );

    DeploymentManager manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy ();
    try {
        server = Undertow.builder()
                .addListener(8080, "localhost")
                .setHandler(manager.start())
                .build();
    } catch (ServletException ex) {
        Logger.getLogger(SimpleServletServer.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
開發者ID:arun-gupta,項目名稱:wildfly-samples,代碼行數:25,代碼來源:SimpleServletServer.java

示例15: main

import io.undertow.servlet.api.DeploymentManager; //導入依賴的package包/類
public static void main(final String... args) throws Exception {
    final DeploymentManager deployment = Servlets.defaultContainer()
        .addDeployment(
            Servlets.deployment()
                .setClassLoader(UndertowContainer.class.getClassLoader())
                .setContextPath("/")
                .setDeploymentName(UndertowContainer.class.getName())
                .addServletContextAttribute(
                    WebSocketDeploymentInfo.ATTRIBUTE_NAME,
                    new WebSocketDeploymentInfo()
                        .addEndpoint(ApplicationConfig.ENDPOINT_CONFIG)
                        .setWorker(Xnio.getInstance().createWorker(OptionMap.builder().getMap()))
                        .setBuffers(new XnioByteBufferPool(new ByteBufferSlicePool(1024, 10240)))
                )
        );
    deployment.deploy();
    final HttpHandler servletHandler = deployment.start();
    Undertow.builder()
        .addHttpListener(Client.PORT, Client.HOST)
        .setHandler(servletHandler)
        .build()
        .start();
}
 
開發者ID:softappeal,項目名稱:yass,代碼行數:24,代碼來源:UndertowContainer.java


注:本文中的io.undertow.servlet.api.DeploymentManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。