Package com.dyuproject.web

Examples of com.dyuproject.web.CookieSession


        if(!GET.equals(request.getMethod()))
        {
            response.sendError(404);
            return;
        }
        CookieSession session = getWebContext().getSession(request);
        User user = _userDao.get((Long)session.getAttribute(Constants.ID));
        request.setAttribute(Constants.USER, user);
        response.setContentType(Constants.TEXT_HTML);
        getWebContext().getJSPDispatcher().dispatch("overview/index.jsp", request,
                response);
    }
View Full Code Here


            response.setContentType(Constants.TEXT_HTML);
            getWebContext().getJSPDispatcher().dispatch("login/index.jsp", request,
                    response);
            return;
        }
        CookieSession session = getWebContext().getSession(request, true);
        session.setAttribute(Constants.ID, user.getId());
        getWebContext().persistSession(session, request, response);
        response.setContentType(Constants.TEXT_HTML);
        response.sendRedirect(request.getContextPath() + "/overview");
    }
View Full Code Here

    }

    public boolean preHandle(RequestContext requestContext)
            throws ServletException, IOException
    {
        CookieSession session = getWebContext().getSession(requestContext.getRequest());       
        if(session!=null && session.getAttribute(Constants.ID)!=null)
            return true;
        requestContext.getResponse().setContentType(Constants.TEXT_HTML);
        getWebContext().getJSPDispatcher().dispatch("login/index.jsp", requestContext.getRequest(),
                requestContext.getResponse());
        return false;
View Full Code Here

        if(!GET.equals(request.getMethod()))
        {
            response.sendError(404);
            return;
        }
        CookieSession session = getWebContext().getSession(request);       
        if(session!=null && session.getAttribute(Constants.ID)!=null)
        {
            response.sendRedirect(request.getContextPath() + "/overview");
            return;
        }
        response.setContentType("text/html");
View Full Code Here

{
   
    public boolean preHandle(RequestContext requestContext)
    throws ServletException, IOException
    {
        CookieSession session = getWebContext().getSession(requestContext.getRequest());       
        if(session!=null && session.getAttribute(Constants.USER)!=null)
            return super.preHandle(requestContext);
        requestContext.getResponse().setContentType(Constants.TEXT_HTML);
        getWebContext().getJSPDispatcher().dispatch("login/index.jsp", requestContext.getRequest(),
                requestContext.getResponse());
        return false;
View Full Code Here

        rc.getResponse().sendRedirect(rc.getRequest().getContextPath() + "/login");
    }
   
    static User getUser(RequestContext rc, WebContext wc)
    {
        CookieSession session = wc.getSession(rc.getRequest());
        return session==null ? null : (User)session.getAttribute(Constants.USER);
    }
View Full Code Here

    }
   
    static void saveUser(User user, RequestContext rc, WebContext wc) throws IOException
    {
        HttpServletRequest request = rc.getRequest();
        CookieSession session = wc.getSession(request, true);
        session.setAttribute(Constants.USER, user);
        wc.persistSession(session, request, rc.getResponse());       
    }
View Full Code Here

TOP

Related Classes of com.dyuproject.web.CookieSession

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.