public ScopedContext getFlashScope(boolean create) { ScopedContext context = null; HttpSession session = ctx.req.getSession(create); if (session != null) { context = (ScopedContext)session.getAttribute("juzu.flash_scope"); if (context == null && create) { session.setAttribute("juzu.flash_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } } return context; }
ServletWebBridge bridge = new ServletWebBridge(this, ctx); if (url != null) { RequestDispatcher dispatcher = getServletContext().getNamedDispatcher("default"); dispatcher.include(bridge.getRequestContext().req, bridge.getResponse()); return;
public static void forgetIdentity() { HttpContext context = Request.getCurrent().getHttpContext(); if (context instanceof ServletWebBridge) { ServletWebBridge bridge = (ServletWebBridge) context; String name = DEFAULT_REMEMBER_ME_COOKIE_NAME; String value = DELETED_COOKIE_VALUE; String domain = context.getServerName(); String path = context.getContextPath(); int maxAge = 0; // always zero for deletion final String headerValue = buildHeaderValue(name, value, domain.trim(), path.trim(), maxAge); bridge.getResponse().setHeader(COOKIE_HEADER_NAME, headerValue); } }
ServletWebBridge bridge = new ServletWebBridge(this, ctx); if (url != null) { RequestDispatcher dispatcher = getServletContext().getNamedDispatcher("default"); dispatcher.include(bridge.getRequestContext().req, bridge.getResponse()); return;
public static void rememberSerialized() { HttpContext context = Request.getCurrent().getHttpContext(); if (context instanceof ServletWebBridge) { ServletWebBridge bridge = (ServletWebBridge) context; // base 64 encode it and store as a cookie: DefaultSerializer<PrincipalCollection> serializer = new DefaultSerializer<PrincipalCollection>(); byte[] serialized = serializer.serialize(SecurityUtils.getSubject().getPrincipals()); serialized = encrypt(serialized); String base64 = Base64.encodeToString(serialized); String name = DEFAULT_REMEMBER_ME_COOKIE_NAME; String value = base64; String domain = context.getServerName(); String path = context.getContextPath(); int maxAge = ONE_YEAR; // always zero for deletion final String headerValue = buildHeaderValue(name, value, domain.trim(), path.trim(), maxAge); bridge.getResponse().setHeader(COOKIE_HEADER_NAME, headerValue); } }
public ScopedContext getRequestScope(boolean create) { ScopedContext context = (ScopedContext)ctx.req.getAttribute("juzu.request_scope"); if (context == null && create) { ctx.req.setAttribute("juzu.request_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } return context; }
public ScopedContext getSessionScope(boolean create) { ScopedContext context = null; HttpSession session = ctx.req.getSession(create); if (session != null) { context = (ScopedContext)session.getAttribute("juzu.session_scope"); if (context == null && create) { session.setAttribute("juzu.session_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } } return context; }
public ScopedContext getFlashScope(boolean create) { ScopedContext context = null; HttpSession session = ctx.req.getSession(create); if (session != null) { context = (ScopedContext)session.getAttribute("juzu.flash_scope"); if (context == null && create) { session.setAttribute("juzu.flash_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } } return context; }
public ScopedContext getRequestScope(boolean create) { ScopedContext context = (ScopedContext)ctx.req.getAttribute("juzu.request_scope"); if (context == null && create) { ctx.req.setAttribute("juzu.request_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } return context; }
public ScopedContext getSessionScope(boolean create) { ScopedContext context = null; HttpSession session = ctx.req.getSession(create); if (session != null) { context = (ScopedContext)session.getAttribute("juzu.session_scope"); if (context == null && create) { session.setAttribute("juzu.session_scope", context = new ServletScopedContext(getLogger(ServletScopedContext.class.getName()))); } } return context; }