Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.SessionManager


                resource_handler.setBaseResource(Resource.newResource(environment.templateDirFile().getPath() + "/assets/"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (settings.getAsBoolean("application.session.enable", false)) {
                SessionManager sessionManager = new HashSessionManager();
                sessionManager.setSessionIdPathParameterName("none");
                handlers.setHandlers(new Handler[]{resource_handler, new SessionHandler(sessionManager), new DefaultHandler()});
            } else {
                handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()});
            }
View Full Code Here


        root.addServlet(new ServletHolder(new FileServlet()), "*.xsl");
        root.addServlet(new ServletHolder(new HelperServlet()), "/rest/helper");
        root.addServlet(new ServletHolder(new LogFileListingServlet()), "/rest/logfilenames");
        root.addServlet(new ServletHolder(new LogFileServlet()), "/rest/logfile");

        final SessionManager sessionManager = root.getSessionHandler().getSessionManager();
        sessionManager.setSessionCookie(JSESSIONID_COOKIE_PREFIX + lastPort);
        sessionManager.setMaxInactiveInterval((Integer)getAttribute(TIME_OUT));

        return server;
    }
View Full Code Here

        connector.setStatsOn(this.config.isRegisterMBeans());
    }

    private void configureSessionManager(final ServletContextHandler context)
    {
        final SessionManager manager = context.getSessionHandler().getSessionManager();

        manager.setMaxInactiveInterval(this.config.getSessionTimeout() * 60);
        manager.setSessionIdPathParameterName(this.config.getProperty(SessionManager.__SessionIdPathParameterNameProperty, SessionManager.__DefaultSessionIdPathParameterName));
        manager.setCheckingRemoteSessionIdEncoding(this.config.getBooleanProperty(SessionManager.__CheckRemoteSessionEncoding, true));
        manager.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE)); // XXX

        SessionCookieConfig cookieConfig = manager.getSessionCookieConfig();
        cookieConfig.setName(this.config.getProperty(SessionManager.__SessionCookieProperty, SessionManager.__DefaultSessionCookie));
        cookieConfig.setDomain(this.config.getProperty(SessionManager.__SessionDomainProperty, SessionManager.__DefaultSessionDomain));
        cookieConfig.setPath(this.config.getProperty(SessionManager.__SessionPathProperty, context.getContextPath()));
        cookieConfig.setMaxAge(this.config.getIntProperty(SessionManager.__MaxAgeProperty, -1));
    }
View Full Code Here

        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.jpeg");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.json");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.txt");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.xsl");

        final SessionManager sessionManager = root.getSessionHandler().getSessionManager();

        sessionManager.setMaxInactiveInterval(_sessionTimeout);

        return server;
    }
View Full Code Here

        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.jpeg");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.json");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.txt");
        root.addServlet(new ServletHolder(FileServlet.INSTANCE), "*.xsl");

        final SessionManager sessionManager = root.getSessionHandler().getSessionManager();

        sessionManager.setMaxInactiveInterval(60 * 15);

        return server;
    }
View Full Code Here

                this.webAppContext.setResourceAlias(entry.getKey(), entry.getValue());
            }
        }

        if (!webAppInfo.distributable && webAppInfo.sessionConfig != null) {
            SessionManager sessionManager = this.webAppContext.getSessionHandler().getSessionManager();
            if (webAppInfo.sessionConfig.sessionTimeoutMinutes != -1) {
                sessionManager.setMaxInactiveInterval(webAppInfo.sessionConfig.sessionTimeoutMinutes * 60);
            }
            sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
            if (webAppInfo.sessionConfig.sessionCookieConfig != null) {
                SessionCookieConfig cookieConfig = sessionManager.getSessionCookieConfig();
                cookieConfig.setName(webAppInfo.sessionConfig.sessionCookieConfig.name);
                cookieConfig.setPath(webAppInfo.sessionConfig.sessionCookieConfig.path);
                cookieConfig.setDomain(webAppInfo.sessionConfig.sessionCookieConfig.domain);
                cookieConfig.setComment(webAppInfo.sessionConfig.sessionCookieConfig.comment);
                cookieConfig.setHttpOnly(webAppInfo.sessionConfig.sessionCookieConfig.httpOnly);
View Full Code Here

  }
 
  private void persistSession(WebAppContext webApp) {
    String storeDir = getStoreDir();
   
    SessionManager sm = webApp.getSessionHandler().getSessionManager();
    if (sm instanceof HashSessionManager) {
      ((HashSessionManager)sm).setStoreDirectory(new File(storeDir));
      return ;
    }
   
View Full Code Here

                this.webAppContext.setResourceAlias(entry.getKey(), entry.getValue());
            }
        }

        if (!webAppInfo.distributable && webAppInfo.sessionConfig != null) {
            SessionManager sessionManager = this.webAppContext.getSessionHandler().getSessionManager();
            if (webAppInfo.sessionConfig.sessionTimeoutMinutes != null) {
                sessionManager.setMaxInactiveInterval(webAppInfo.sessionConfig.sessionTimeoutMinutes * 60);
            }
            if (webAppInfo.sessionConfig.sessionTrackingModes != null) {
                sessionManager.setSessionTrackingModes(webAppInfo.sessionConfig.sessionTrackingModes);
            }
            SessionCookieConfigInfo sessionCookieConfigInfo = webAppInfo.sessionConfig.sessionCookieConfig;
            if (sessionCookieConfigInfo != null) {
                SessionCookieConfig cookieConfig = sessionManager.getSessionCookieConfig();
                if (sessionCookieConfigInfo.name != null) {
                    cookieConfig.setName(sessionCookieConfigInfo.name);
                }
                if (sessionCookieConfigInfo.comment != null) {
                    cookieConfig.setComment(sessionCookieConfigInfo.comment);
View Full Code Here

        connector.setStatsOn(this.config.isRegisterMBeans());
    }

    private void configureSessionManager(final ServletContextHandler context)
    {
        final SessionManager manager = context.getSessionHandler().getSessionManager();

        manager.setMaxInactiveInterval(this.config.getSessionTimeout() * 60);
        manager.setSessionIdPathParameterName(this.config.getProperty(SessionManager.__SessionIdPathParameterNameProperty, SessionManager.__DefaultSessionIdPathParameterName));
        manager.setCheckingRemoteSessionIdEncoding(this.config.getBooleanProperty(SessionManager.__CheckRemoteSessionEncoding, true));
        manager.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE)); // XXX

        SessionCookieConfig cookieConfig = manager.getSessionCookieConfig();
        cookieConfig.setName(this.config.getProperty(SessionManager.__SessionCookieProperty, SessionManager.__DefaultSessionCookie));
        cookieConfig.setDomain(this.config.getProperty(SessionManager.__SessionDomainProperty, SessionManager.__DefaultSessionDomain));
        cookieConfig.setPath(this.config.getProperty(SessionManager.__SessionPathProperty, context.getContextPath()));
        cookieConfig.setMaxAge(this.config.getIntProperty(SessionManager.__MaxAgeProperty, -1));
    }
View Full Code Here

    protected Server createStaticResourcesServer(Server server, ServletContextHandler context, String home) throws Exception {

        context.setContextPath("/");

        SessionManager sm = new HashSessionManager();
        SessionHandler sh = new SessionHandler(sm);
        context.setSessionHandler(sh);

        if (home != null) {
            String[] resources = home.split(":");
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.SessionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.