当前位置: 首页>>代码示例>>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;未经允许,请勿转载。