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