Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.SessionManager


                {

                    SessionHandler sessionHandler = (SessionHandler)((ContextHandler)contexts[i]).getChildHandlerByClass(SessionHandler.class);
                    if (sessionHandler != null)
                    {
                        SessionManager manager = sessionHandler.getSessionManager();
                        if (manager != null && manager instanceof JDBCSessionManager)
                        {
                            ((JDBCSessionManager)manager).expire(expiredSessionIds);
                        }
                    }
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

    private void forEachSessionManager(SessionManagerCallback callback) {
        Handler[] contexts = server.getChildHandlersByClass(ContextHandler.class);
        for (int i = 0; contexts != null && i < contexts.length; i++) {
            SessionHandler sessionHandler = ((ContextHandler) contexts[i]).getChildHandlerByClass(SessionHandler.class);
            if (sessionHandler != null) {
                SessionManager manager = sessionHandler.getSessionManager();
                if (manager != null && manager instanceof SessionManagerSkeleton)
                    callback.execute((SessionManagerSkeleton) manager);
            }
        }
    }
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

        for (int i = 0; contexts != null && i < contexts.length; i++)
        {
            SessionHandler sessionHandler = ((ContextHandler) contexts[i]).getChildHandlerByClass(SessionHandler.class);
            if (sessionHandler != null)
            {
                SessionManager manager = sessionHandler.getSessionManager();
                if (manager != null && manager instanceof KeyValueStoreSessionManager)
                {
                    ((KeyValueStoreSessionManager) manager).invalidateSession(sessionId);
                }
            }
View Full Code Here

        for (int i = 0; contexts != null && i < contexts.length; i++)
        {
            SessionHandler sessionHandler = ((ContextHandler) contexts[i]).getChildHandlerByClass(SessionHandler.class);
            if (sessionHandler != null)
            {
                SessionManager manager = sessionHandler.getSessionManager();

                if (manager != null && manager instanceof KeyValueStoreSessionManager)
                {
                    ((KeyValueStoreSessionManager) manager).renewSessionId(oldClusterId, oldNodeId, newClusterId,
                        getNodeId(newClusterId, request));
View Full Code Here

     */
    public void setSessionManager(SessionManager sessionManager)
    {
        if (isStarted())
            throw new IllegalStateException();
        SessionManager old_session_manager = _sessionManager;

        if (getServer()!=null)
            getServer().getContainer().update(this, old_session_manager, sessionManager, "sessionManager",true);

        if (sessionManager!=null)
            sessionManager.setSessionHandler(this);

        _sessionManager = sessionManager;

        if (old_session_manager!=null)
            old_session_manager.setSessionHandler(null);
    }
View Full Code Here

     */
    @Override
    public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException
    {
        SessionManager old_session_manager=null;
        HttpSession old_session=null;
        HttpSession access=null;
        try
        {
            old_session_manager = baseRequest.getSessionManager();
View Full Code Here

     */
    protected void checkRequestedSessionId(Request baseRequest, HttpServletRequest request)
    {
        String requested_session_id=request.getRequestedSessionId();
       
        SessionManager sessionManager = getSessionManager();
       
        if (requested_session_id!=null && sessionManager!=null)
        {
            HttpSession session=sessionManager.getHttpSession(requested_session_id);
            if (session!=null && sessionManager.isValid(session))
                baseRequest.setSession(session);
            return;
        }
        else if (!DispatcherType.REQUEST.equals(baseRequest.getDispatcherType()))
            return;

        boolean requested_session_id_from_cookie=false;
        HttpSession session=null;

        // Look for session id cookie
        if (_sessionManager.isUsingCookies())
        {
            Cookie[] cookies=request.getCookies();
            if (cookies!=null && cookies.length>0)
            {
                for (int i=0;i<cookies.length;i++)
                {
                    if (sessionManager.getSessionCookie().equalsIgnoreCase(cookies[i].getName()))
                    {
                        requested_session_id=cookies[i].getValue();
                        requested_session_id_from_cookie = true;
                        if(LOG.isDebugEnabled())
                            LOG.debug("Got Session ID {} from cookie",requested_session_id);
                       
                        session=sessionManager.getHttpSession(requested_session_id);
                        if (session!=null && sessionManager.isValid(session))
                            break;
                    }
                }
            }
        }

        if (requested_session_id==null || session==null)
        {
            String uri = request.getRequestURI();

            String prefix=sessionManager.getSessionIdPathParameterNamePrefix();
            if (prefix!=null)
            {
                int s = uri.indexOf(prefix);
                if (s>=0)
                {  
                    s+=prefix.length();
                    int i=s;
                    while (i<uri.length())
                    {
                        char c=uri.charAt(i);
                        if (c==';'||c=='#'||c=='?'||c=='/')
                            break;
                        i++;
                    }

                    requested_session_id = uri.substring(s,i);
                    requested_session_id_from_cookie = false;
                    session=sessionManager.getHttpSession(requested_session_id);
                    if(LOG.isDebugEnabled())
                        LOG.debug("Got Session ID {} from URL",requested_session_id);
                }
            }
        }

        baseRequest.setRequestedSessionId(requested_session_id);
        baseRequest.setRequestedSessionIdFromCookie(requested_session_id!=null && requested_session_id_from_cookie);
        if (session!=null && sessionManager.isValid(session))
            baseRequest.setSession(session);                
    }
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.