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


Java ServletContextHandler.SESSIONS屬性代碼示例

本文整理匯總了Java中org.eclipse.jetty.servlet.ServletContextHandler.SESSIONS屬性的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextHandler.SESSIONS屬性的具體用法?Java ServletContextHandler.SESSIONS怎麽用?Java ServletContextHandler.SESSIONS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.jetty.servlet.ServletContextHandler的用法示例。


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

示例1: main

public static void main(String[] args) {
    int port = Configuration.INSTANCE.getInt("port", 8080);
    Server server = new Server(port);
    ServletContextHandler contextHandler
            = new ServletContextHandler(ServletContextHandler.SESSIONS);
    contextHandler.setContextPath("/");
    ServletHolder sh = new ServletHolder(new VaadinServlet());
    contextHandler.addServlet(sh, "/*");
    contextHandler.setInitParameter("ui", AnalysisUI.class.getCanonicalName());
    contextHandler.setInitParameter("productionMode", String.valueOf(PRODUCTION_MODE));
    server.setHandler(contextHandler);
    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOG.error("Failed to start application", e);
    }
}
 
開發者ID:tokenmill,項目名稱:crawling-framework,代碼行數:18,代碼來源:Application.java

示例2: main

public static void main(String[] args) throws Exception {

        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setResourceBase(PUBLIC_HTML);

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

        //page reloaded by the timer
        context.addServlet(TimerServlet.class, "/timer");
        //part of a page reloaded by the timer
        context.addServlet(AjaxTimerServlet.class, "/server-time");
        //long-polling waits till a message
        context.addServlet(new ServletHolder(new MessengerServlet()), "/messenger");
        //web chat
        context.addServlet(WebSocketChatServlet.class, "/chat");

        Server server = new Server(PORT);
        server.setHandler(new HandlerList(resourceHandler, context));

        server.start();
        server.join();
    }
 
開發者ID:vitaly-chibrikov,項目名稱:otus_java_2017_06,代碼行數:22,代碼來源:Main.java

示例3: main

public static void main(String[] args) throws Exception {

        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setResourceBase(PUBLIC_HTML);

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

        context.addServlet(new ServletHolder(new LoginServlet("anonymous")), "/login");
        context.addServlet(AdminServlet.class, "/admin");
        context.addServlet(TimerServlet.class, "/timer");

        Server server = new Server(PORT);
        server.setHandler(new HandlerList(resourceHandler, context));

        server.start();
        server.join();
    }
 
開發者ID:vitaly-chibrikov,項目名稱:otus_java_2017_04,代碼行數:17,代碼來源:Main.java

示例4: initApi

private void initApi() {
    ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
    servletHandler.setContextPath("/api");
    servletHandler.getSessionHandler().setSessionManager(sessionManager);

    servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/socket");

    ResourceConfig resourceConfig = new ResourceConfig();
    resourceConfig.registerClasses(JacksonFeature.class, ObjectMapperProvider.class, ResourceErrorHandler.class);
    resourceConfig.registerClasses(SecurityRequestFilter.class, CorsResponseFilter.class);
    resourceConfig.packages(ServerResource.class.getPackage().getName());

    servletHandler.addServlet(new ServletHolder(new ServletContainer(resourceConfig)), "/*");

    handlers.addHandler(servletHandler);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:16,代碼來源:WebServer.java

示例5: main

public static void main(@NotNull @NonNls String[] args) throws Exception {
	PropertyConfigurator.configure(System.getProperty("user.dir") + "/log4j.properties");
	logger.warn("StrictFP | Back-end");
	logger.info("StrictFP Back-end is now running...");
	Server server = new Server(Constant.SERVER.SERVER_PORT);
	ServletContextHandler context =
			new ServletContextHandler(ServletContextHandler.SESSIONS);
	context.setContextPath("/api/v0");
	server.setHandler(context);
	server.setStopAtShutdown(true);
	// 像下麵這行一樣
	context.addServlet(new ServletHolder(new GetQuiz()), "/misc/getquiz");
	context.addServlet(new ServletHolder(new TimeLine()), "/timeline");
	context.addServlet(new ServletHolder(new Counter()), "/misc/counter");
	context.addServlet(new ServletHolder(new User()), "/user");
	context.addServlet(new ServletHolder(new Heartbeat()), "/misc/heartbeat");
	context.addServlet(new ServletHolder(new SafeCheck()), "/misc/safecheck");
	context.addServlet(new ServletHolder(new CheckCert()), "/auth/check_cert");
	//
	server.start();
	server.join();
}
 
開發者ID:ProgramLeague,項目名稱:strictfp-back-end,代碼行數:22,代碼來源:MainServer.java

示例6: main

public static void main(String[] args) throws Exception {
	Runtime.getRuntime().addShutdownHook(new ShutdownHook());

	Initiator.init();

	Server server = new Server(PORT);
	ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
	context.setContextPath(CONTEXT_PATH);
	server.setHandler(context);
	server.setStopAtShutdown(true);

	context.addServlet(new ServletHolder(new GetAllLang()), "/get_all_lang");
	context.addServlet(new ServletHolder(new Compile()), "/compile");
	context.addServlet(new ServletHolder(new Run()), "/run");
	server.join();
	server.start();

	LOGGER.info("Avalon-Executive server is now running at http://127.0.0.1:" + PORT + CONTEXT_PATH);
}
 
開發者ID:ProgramLeague,項目名稱:Avalon-Executive,代碼行數:19,代碼來源:MainServer.java

示例7: setUp

@Before
public void setUp() throws Exception {
    server = new Server(PORT);

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

    servletHolder = new ServletHolder(new CamelWebSocketServlet());
    servletHolder.setName("CamelWsServlet");
    context.addServlet(servletHolder, "/*");
    
    server.start();
    
    if (startCamelContext) {        
        super.setUp();
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:18,代碼來源:WebsocketCamelRouterTestSupport.java

示例8: run

public void run() throws Exception {

		org.eclipse.jetty.util.log.Log.setLog(new Slf4jLog());
		Server server = new Server(port);
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/");
        context.setResourceBase(httpPath);
        HashSessionIdManager idmanager = new HashSessionIdManager();
        server.setSessionIdManager(idmanager);
        HashSessionManager manager = new HashSessionManager();
        SessionHandler sessions = new SessionHandler(manager);
        sessions.setHandler(context);
        context.addServlet(new ServletHolder(new Servlet(this::getPinto)),"/pinto/*");
        ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
        context.addServlet(holderPwd,"/*");
        server.setHandler(sessions);
		new Thread(new Console(getPinto(),port,build, () -> {
			try {
				server.stop();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}), "console_thread").start();
        server.start();
        server.join();
	}
 
開發者ID:punkbrwstr,項目名稱:pinto,代碼行數:26,代碼來源:Main.java

示例9: doStart

@Override
protected void doStart() throws Exception {
    super.doStart();

    if (staticResources != null) {
        // host and port must be configured
        ObjectHelper.notEmpty(host, "host", this);
        ObjectHelper.notNull(port, "port", this);

        LOG.info("Starting static resources server {}:{} with static resource: {}", new Object[]{host, port, staticResources});
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        staticResourcesServer = createStaticResourcesServer(context, host, port, staticResources);
        staticResourcesServer.start();
        ServerConnector connector = (ServerConnector) staticResourcesServer.getConnectors()[0];

        // must add static resource server to CONNECTORS in case the websocket producers/consumers
        // uses the same port number, and therefore we must be part of this
        MemoryWebsocketStore memoryStore = new MemoryWebsocketStore();
        ConnectorRef ref = new ConnectorRef(staticResourcesServer, connector, null, memoryStore);
        String key = "websocket:" + host + ":" + port;
        CONNECTORS.put(key, ref);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:23,代碼來源:WebsocketComponent.java

示例10: setUp

@Before
@Override
public void setUp() throws Exception {
    server = new Server(9000);

    ServerConnector connector0 = new ServerConnector(server);
    connector0.setReuseAddress(true);
    server.setConnectors(new Connector[]{connector0});

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/service");
    server.setHandler(context);
    context.addServlet(new ServletHolder(new EchoService()), "/EchoService");
    server.start();

    payload = readPayload();

    super.setUp();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:19,代碼來源:AbstractBaseEsbPerformanceIntegrationTest.java

示例11: addServlet

public void addServlet(String path, ServletHolder servletHolder, boolean requiresAuthentication) {
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(path);
    context.addServlet(servletHolder, MATCH_ALL);
    context.setAttribute(WebService.ATTRIBUTE_PULSAR_NAME, pulsar);

    if (requiresAuthentication && pulsar.getConfiguration().isAuthenticationEnabled()) {
        FilterHolder filter = new FilterHolder(new AuthenticationFilter(pulsar));
        context.addFilter(filter, MATCH_ALL, EnumSet.allOf(DispatcherType.class));
    }

    FilterHolder responseFilter = new FilterHolder(new ResponseHandlerFilter(pulsar));
    context.addFilter(responseFilter, MATCH_ALL, EnumSet.allOf(DispatcherType.class));

    handlers.add(context);
}
 
開發者ID:apache,項目名稱:incubator-pulsar,代碼行數:16,代碼來源:WebService.java

示例12: run

@Override
public void run() {
	try {
		File JETTY_DIR = new File(Environment.getExternalStorageDirectory(), "jetty");
		// Set jetty.home
		System.setProperty("jetty.home", JETTY_DIR.getAbsolutePath());

		// ipv6 workaround for froyo
		System.setProperty("java.net.preferIPv6Addresses", "false");

		server = new Server(8090);
		// server.setHandler(new DefaultHandler());
		ServletContextHandler contextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
		contextHandler.setContextPath("/");
		server.setHandler(contextHandler);
		ServlertConfig.config(contextHandler);

		server.start();
		server.join();

		mHandler.sendEmptyMessage(open_server);
	} catch (Exception e) {
		server = null;
		e.printStackTrace();
		System.out.println("Exception");
		mHandler.sendEmptyMessage(open_server_fail);
	}
}
 
開發者ID:JackChan1999,項目名稱:TakeoutService,代碼行數:28,代碼來源:WebService.java

示例13: LogServer

public LogServer(MergedLogSource src) throws Exception {
super(ServletContextHandler.SESSIONS);
setContextPath("/");

addServlet(new ServletHolder(new StaticContent()),"/graph/*");

addServlet(new ServletHolder(new Fs()),"/fs");
addServlet(new ServletHolder(new GraphData(src)), "/data");
addServlet(new ServletHolder(new FileLoader(src)), "/loadfile");
addServlet(new ServletHolder(new NumEvents(src)), "/info");
addServlet(new ServletHolder(new Throughput(src)), "/throughput");
   }
 
開發者ID:didichuxing2,項目名稱:https-github.com-apache-zookeeper,代碼行數:12,代碼來源:LogServer.java

示例14: main

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,代碼行數:33,代碼來源:RestServer.java

示例15: startJetty

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,代碼行數:39,代碼來源:App.java


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