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


Java ServletHolder.setInitOrder方法代码示例

本文整理汇总了Java中org.eclipse.jetty.servlet.ServletHolder.setInitOrder方法的典型用法代码示例。如果您正苦于以下问题:Java ServletHolder.setInitOrder方法的具体用法?Java ServletHolder.setInitOrder怎么用?Java ServletHolder.setInitOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.servlet.ServletHolder的用法示例。


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

示例1: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");

        Server jettyServer = new Server(8067);
        jettyServer.setHandler(context);

        ServletHolder jerseyServlet = context.addServlet(
                org.glassfish.jersey.servlet.ServletContainer.class, "/*");
        jerseyServlet.setInitOrder(0);

        // Tells the Jersey Servlet which REST service/class to load.
        jerseyServlet.setInitParameter(
                "jersey.config.server.provider.classnames",
                EntryPointTestHandler.class.getCanonicalName());

        try {
            jettyServer.start();
            jettyServer.join();
        } finally {
            jettyServer.destroy();
        }
    }
 
开发者ID:warlock-china,项目名称:wisp,代码行数:25,代码来源:ServerMain.java

示例2: start

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void start() throws Exception {
    Server server = new Server(REST_SERVICE_PORT);

    ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    servletContextHandler.setContextPath("/");
    server.setHandler(servletContextHandler);

    ServletHolder servletHolder = servletContextHandler.addServlet(
            org.glassfish.jersey.servlet.ServletContainer.class, "/*"
    );
    servletHolder.setInitOrder(0);
    servletHolder.setInitParameter(
            "jersey.config.server.provider.classnames",
            RestInterface.class.getCanonicalName()
    );

    try {
        server.start();
        server.join();
    } finally {
        server.destroy();
    }
}
 
开发者ID:brmson,项目名称:jobimservice,代码行数:24,代码来源:RestServer.java

示例3: init

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void init() {
    setContextPath("/management");

    // REST configuration
    Servlet servlet = context.servlets().iterator().next();
    final ServletHolder servletHolder = new ServletHolder(servlet);
    servletHolder.setInitParameter("javax.ws.rs.Application", "io.gravitee.am.gateway.handler.management.api.ManagementApplication");
    servletHolder.setInitOrder(0);
    addServlet(servletHolder, "/*");

    // Attach event listeners
    for(EventListener listener : context.listeners()) {
        addEventListener(listener);
    }

    // Attach filters
    for(Filter filter : context.filters()) {
        addFilter(new FilterHolder(filter), MAPPING_URL, EnumSet.allOf(DispatcherType.class));
    }
}
 
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:21,代码来源:ManagementContextHandler.java

示例4: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("/");

  Server jettyServer =
      new Server(new InetSocketAddress(Config.getInstance().getServerHost(), Config.getInstance().getServerPort()));

  jettyServer.setHandler(context);

  ServletHolder echoServlet = context.addServlet(EchoBotServlet.class, "/echo");
  echoServlet.setInitOrder(0);
  ServletHolder logServlet = context.addServlet(LogBotServlet.class, "/log");
  logServlet.setInitOrder(1);

  try {
    jettyServer.start();
    jettyServer.join();
  } finally {
    jettyServer.destroy();
  }
}
 
开发者ID:restfb,项目名称:restfb-example-chatbot,代码行数:22,代码来源:App.java

示例5: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/rest/");
 
    Server jettyServer = new Server(8080);
    jettyServer.setHandler(context);
 
    ServletHolder jerseyServlet = context.addServlet(
         org.glassfish.jersey.servlet.ServletContainer.class, "/*");
    jerseyServlet.setInitOrder(0);

    jerseyServlet.setInitParameter("jersey.config.server.provider.packages",
        "com.rest.test; com.rest.crud; com.rest.howtotoinjava");
 
    try {
        jettyServer.start();
        jettyServer.join();
    } finally {
        jettyServer.destroy();
    }
}
 
开发者ID:zekaf,项目名称:jetty-nodes,代码行数:22,代码来源:App.java

示例6: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * 
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
	ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
	context.setContextPath("/");
	Logger mainLogger = Logger.getInstance();
	mainLogger.out(Level.INFORMATIVE, "Main", "Starting server");
	Server server = new Server(8080);
	mainLogger.out(Level.INFORMATIVE, "Main", "Set handler");
	server.setHandler(context);

	ServletHolder jerseyServlet = context.addServlet(ServletContainer.class, "/*");
	jerseyServlet.setInitOrder(0);

	jerseyServlet.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");
	jerseyServlet.setInitParameter("jersey.config.server.provider.packages", "view");

	server.start();
	server.join();
	mainLogger.out(Level.INFORMATIVE, "Main", "Server started");
}
 
开发者ID:MartijnDevNull,项目名称:storytime-backend,代码行数:25,代码来源:StartServer.java

示例7: start

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public void start() {
    workingDir.mkdirs();
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");

    ServletHolder jerseyServlet = context.addServlet(ServletContainer.class, "/*");
    jerseyServlet.setInitOrder(0);
    jerseyServlet.setInitParameter("javax.ws.rs.Application", AssemblerApp.class.getCanonicalName());

    Server jettyServer = new Server(port);
    jettyServer.setHandler(context);

    try {
        jettyServer.start();
        int runningPort = getPort(jettyServer);
        System.out.printf("Server started successfully and is running on port %s.\n", runningPort);
        writePort(runningPort);
        jettyServer.join();
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        jettyServer.destroy();
    }
}
 
开发者ID:mmhelloworld,项目名称:jvm-assembler,代码行数:25,代码来源:AssemblerServer.java

示例8: start

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
@Override
public void start() {
    if (isStarted()) {
        return;
    }
    jettyServer = new org.eclipse.jetty.server.Server();
    int port = serverConfig.getPort();
    DispatcherServlet.addHttpHandler(port, new WebServiceHandler());

    int threads = serverConfig.getServerBusinessPoolSize();
    QueuedThreadPool threadPool = new QueuedThreadPool();
    threadPool.setName("JSF-WS-BZ");
    threadPool.setDaemon(true);
    threadPool.setMaxThreads(threads);
    threadPool.setMinThreads(threads);
    jettyServer.setThreadPool(threadPool);

    SelectChannelConnector connector = new SelectChannelConnector();
    connector.setHost(serverConfig.getHost());
    connector.setPort(serverConfig.getPort());
    jettyServer.addConnector(connector);

    ServletHandler servletHandler = new ServletHandler();
    ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*");
    servletHolder.setInitOrder(2);

    jettyServer.setHandler(servletHandler);

    try {
        jettyServer.start();
    } catch (Exception e) {
        throw new InitErrorException("Failed to start jetty server at port " + port
                + ", cause: " + e.getMessage(), e);
    }
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:36,代码来源:HttpWsServer.java

示例9: addToJettyServer

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
@Override
public void addToJettyServer(JettyServer jettyServer) {
    ServletHolder apiDocServletHolder = new ServletHolder(new JerseyJaxrsConfig());
    apiDocServletHolder.setInitParameter("api.version", apiVersion);
    //Remove leading / as swagger adds its own
    String apiBasePath =
            "//".equals(this.apiBasePath.substring(0, 1))
                    ? this.apiBasePath.substring(1)
                    : this.apiBasePath;
    apiDocServletHolder.setInitParameter("swagger.api.basepath", apiBasePath);
    apiDocServletHolder.setInitOrder(2); //NOSONAR
    jettyServer.getServletContext().addServlet(apiDocServletHolder, pathSpec);
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:14,代码来源:SwaggerAddon.java

示例10: startJetty

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void startJetty() throws Exception {
        // Jetty 起動
        HandlerList handlers = new HandlerList();

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        ServletHolder servletHolder = context.addServlet(ServletContainer.class, "/*");
        servletHolder.setInitOrder(0);
        servletHolder.setInitParameter(
                "com.sun.jersey.spi.container.ContainerResponseFilters",
                "com.sun.jersey.api.container.filter.GZIPContentEncodingFilter");

        // Pasaran API
        RestAPIs.installRestApi(servletHolder,
                CORSResponseFilter.class,
                KeseranApi.class);

        // 静的コンテンツ
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setResourceBase("web");
        handlers.addHandler(resourceHandler);
        handlers.addHandler(context);

        String port = System.getProperty("jetty-port", "2510");
        Server jetty = new Server(Integer.parseInt(port));
        jetty.setHandler(handlers);
        try {
//            RolloverFileOutputStream os = new RolloverFileOutputStream("logs/yyyy_mm_dd_jetty.log", true);
//            PrintStream logStream = new PrintStream(os);
//            System.setOut(logStream);
//            System.setErr(logStream);
//            Log.getRootLogger().info("JCG Embedded Jetty logging started.", new Object[]{});

            jetty.start();
            jetty.join();
        } finally {
            jetty.destroy();
        }
    }
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:40,代码来源:App.java

示例11: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    int port = getPort(args);
    Path configDir = getConfigDir(args);
    System.out.println("Configuring MNP storage from config directory: "+configDir);

    Builder builder = Builder.builder();
    storage = builder.
            add(new RossvyazMasksParser(configDir.resolve("rossvyaz/Kody_DEF-9kh.csv"))).
            add(new CustomMasksParser(configDir.resolve("mnos.xml"))).
            //add(new ZniisMnpParser(configDir.resolve("zniis/"))).
            idTitle(configDir.resolve("filters/titles.xml")).
            idRegion(configDir.resolve("filters/areas.xml")).
            build();
    System.out.println("Starting server on port: "+port);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    Server jettyServer = new Server(port);

    jettyServer.setHandler(context);
    ServletHolder jerseyServlet = context.addServlet(
            org.glassfish.jersey.servlet.ServletContainer.class, "/*");
    jerseyServlet.setInitOrder(0);
    jerseyServlet.setInitParameter(
            "jersey.config.server.provider.classnames",
            MnpApi.class.getCanonicalName());
    try {
        jettyServer.start();
        System.out.println("Server started. Example request: http://localhost:"+port+"/mnp?subscriber=79139367911");
        jettyServer.join();
    } finally {
        jettyServer.destroy();
    }
}
 
开发者ID:chukanov,项目名称:mnp,代码行数:34,代码来源:RestServer.java

示例12: addJerseyServlet

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
private void addJerseyServlet(ServletContextHandler context) {
    ServletHolder jerseyServlet = context.addServlet(ServletContainer.class, REST_PATH);
    jerseyServlet.setInitParameter("jersey.config.server.provider.packages", "io.sparkled.rest");
    jerseyServlet.setInitParameter("jersey.config.server.provider.classnames", MultiPartFeature.class.getName());
    jerseyServlet.setInitParameter("javax.ws.rs.Application", JerseyResourceConfig.class.getName());
    jerseyServlet.setInitOrder(0);
}
 
开发者ID:sparkled,项目名称:sparkled,代码行数:8,代码来源:RestApiServerImpl.java

示例13: jspServletHolder

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
private ServletHolder jspServletHolder() {
    ServletHolder holderJsp = new ServletHolder(JSP, JettyJspServlet.class);
    holderJsp.setInitOrder(0);
    holderJsp.setInitParameter(LOG_VERBOSITY_LEVEL, DEBUG);
    holderJsp.setInitParameter(FORK, "false");
    holderJsp.setInitParameter(XPOWERED_BY, "false");
    holderJsp.setInitParameter(COMPILER_TARGET_VM, "1.7");
    holderJsp.setInitParameter(COMPILER_SOURCE_VM, "1.7");
    holderJsp.setInitParameter(KEEPGENERATED, "true");
    return holderJsp;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:12,代码来源:JettyLauncher.java

示例14: main

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Server server = new Server(8080);
    ServletContextHandler handler = new ServletContextHandler();
    handler.setContextPath("/");
    handler.setInitParameter("contextConfigLocation", "classpath*:spring-mvc.xml");
    ServletHolder servletHolder = new ServletHolder();
    servletHolder.setInitOrder(1);
    servletHolder.setHeldClass(DispatcherServlet.class);
    servletHolder.setInitParameter("contextConfigLocation", "classpath*:spring-mvc.xml");
    handler.addServlet(servletHolder, "/");
    server.setHandler(handler);
    server.start();
    server.join();
}
 
开发者ID:archerfeel,项目名称:awacs,代码行数:15,代码来源:WebappBoot.java

示例15: addDefaultServlet

import org.eclipse.jetty.servlet.ServletHolder; //导入方法依赖的package包/类
/**
 * Add Jetty's {@code DefaultServlet} to the given {@link WebAppContext}.
 * @param context the jetty {@link WebAppContext}
 */
protected final void addDefaultServlet(WebAppContext context) {
	Assert.notNull(context, "Context must not be null");
	ServletHolder holder = new ServletHolder();
	holder.setName("default");
	holder.setClassName("org.eclipse.jetty.servlet.DefaultServlet");
	holder.setInitParameter("dirAllowed", "false");
	holder.setInitOrder(1);
	context.getServletHandler().addServletWithMapping(holder, "/");
	context.getServletHandler().getServletMapping("/").setDefault(true);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:JettyEmbeddedServletContainerFactory.java


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