Package org.mortbay.jetty

Examples of org.mortbay.jetty.SessionManager


            throws IOException, ServletException
    {
        setRequestedId(request, dispatch);
       
        Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
        SessionManager old_session_manager=null;
        HttpSession old_session=null;
       
        try
        {
            old_session_manager = base_request.getSessionManager();
View Full Code Here


        if (dispatch!=REQUEST || requested_session_id!=null)
        {
            return;
        }
       
        final SessionManager sessionManager = getSessionManager();
        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()))
                    {
                        if (requested_session_id!=null)
                        {
                            // Multiple jsessionid cookies. Probably due to
                            // multiple paths and/or domains. Pick the first
                            // known session or the last defined cookie.
                            if (sessionManager.getHttpSession(requested_session_id)!=null)
                                break;
                        }

                        requested_session_id=cookies[i].getValue();
                        requested_session_id_from_cookie = true;
                        if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from cookie");
                       
                        session=sessionManager.getHttpSession(requested_session_id);
                        if (session!=null)
                            base_request.setSession(session);
                    }
                }
            }
        }
       
        if (requested_session_id==null || session==null)
        {
            String uri = request.getRequestURI();

            String prefix=sessionManager.getSessionURLPrefix();
            if (prefix!=null)
            {
                int s = uri.indexOf(prefix);
                if (s>=0)
                {  
View Full Code Here

                }
            }
        };

        SessionHandler sessionHandler = new SessionHandler();
        SessionManager sessionManager = new HashSessionManager();
        sessionManager.setIdManager(new HashSessionIdManager());
        sessionHandler.setSessionManager(sessionManager);
        sessionHandler.setHandler(handler);

        context.setHandler(sessionHandler);
    }
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

            throws IOException, ServletException
    {
        setRequestedId(request, dispatch);
       
        Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
        SessionManager old_session_manager=null;
        HttpSession old_session=null;
       
        try
        {
            old_session_manager = base_request.getSessionManager();
View Full Code Here

        if (dispatch!=REQUEST || requested_session_id!=null)
        {
            return;
        }
       
        SessionManager sessionManager = getSessionManager();
        boolean requested_session_id_from_cookie=false;
       
        // 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()))
                    {
                        if (requested_session_id!=null)
                        {
                            // Multiple jsessionid cookies. Probably due to
                            // multiple paths and/or domains. Pick the first
                            // known session or the last defined cookie.
                            if (sessionManager.getHttpSession(requested_session_id)!=null)
                                break;
                        }

                        requested_session_id=cookies[i].getValue();
                        requested_session_id_from_cookie = true;
                        if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from cookie");
                    }
                }
            }
        }
       
        if (requested_session_id==null)
        {
            String uri = request.getRequestURI();
           
            int semi = uri.lastIndexOf(';');
            if (semi>=0)
            {  
                String path_params=uri.substring(semi+1);
               
                // check if there is a url encoded session param.
                String param=sessionManager.getSessionURL();
                if (param!=null && path_params!=null && path_params.startsWith(param))
                {
                    requested_session_id = path_params.substring(sessionManager.getSessionURL().length()+1);
                    if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from URL");
                }
            }
        }
       
View Full Code Here

                }
            }
        };

        final SessionHandler sessionHandler = new SessionHandler();
        final SessionManager sessionManager = new HashSessionManager();
        sessionManager.setIdManager(new HashSessionIdManager());
        sessionHandler.setSessionManager(sessionManager);
        sessionHandler.setHandler(handler);

        context.setHandler(sessionHandler);
    }
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

            throws IOException, ServletException
    {
        setRequestedId(request, dispatch);
       
        Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
        SessionManager old_session_manager=null;
        HttpSession old_session=null;
       
        try
        {
            old_session_manager = base_request.getSessionManager();
View Full Code Here

        if (dispatch!=REQUEST || requested_session_id!=null)
        {
            return;
        }
       
        final SessionManager sessionManager = getSessionManager();
        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()))
                    {
                        if (requested_session_id!=null)
                        {
                            // Multiple jsessionid cookies. Probably due to
                            // multiple paths and/or domains. Pick the first
                            // known session or the last defined cookie.
                            if (sessionManager.getHttpSession(requested_session_id)!=null)
                                break;
                        }

                        requested_session_id=cookies[i].getValue();
                        requested_session_id_from_cookie = true;
                        if(Log.isDebugEnabled())Log.debug("Got Session ID "+requested_session_id+" from cookie");
                       
                        session=sessionManager.getHttpSession(requested_session_id);
                        if (session!=null)
                            base_request.setSession(session);
                    }
                }
            }
        }
       
        if (requested_session_id==null || session==null)
        {
            String uri = request.getRequestURI();
           
            int semi = uri.lastIndexOf(';');
            if (semi>=0)
            {  
                // check if there is a url encoded session param.
                String param=sessionManager.getSessionURL();
                if (param!=null)
                {
                    int p=uri.indexOf(param,semi+1);
                    if (p>0)
                    {
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.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.