/** * Changes the icon size by changing the cookie */ public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { String qs = req.getQueryString(); if(qs==null) throw new ServletException(); Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs)); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if(ref==null) ref="."; rsp.sendRedirect2(ref); }
/** * Handles the logout processing. * * <p> * The default implementation erases the session and do a few other clean up, then * redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if(session!=null) session.invalidate(); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); // reset remember-me cookie Cookie cookie = new Cookie(ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY,""); cookie.setMaxAge(0); cookie.setSecure(req.isSecure()); cookie.setHttpOnly(true); cookie.setPath(req.getContextPath().length()>0 ? req.getContextPath() : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req,auth)); }
/** {@inheritDoc} */ @Override public void addCookie(Cookie cookie) { getWrapped().addCookie(cookie); }
/** {@inheritDoc} */ @Override public void addCookie(Cookie cookie) { getWrapped().addCookie(cookie); }
/** * Changes the icon size by changing the cookie */ public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { String qs = req.getQueryString(); if (qs == null || !ICON_SIZE.matcher(qs).matches()) { throw new ServletException(); } Cookie cookie = new Cookie("iconSize", qs); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if (ref == null) { ref = "."; } rsp.sendRedirect2(ref); }
/** * Changes the icon size by changing the cookie */ public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { String qs = req.getQueryString(); if (qs == null || !ICON_SIZE.matcher(qs).matches()) { throw new ServletException(); } Cookie cookie = new Cookie("iconSize", qs); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if (ref == null) { ref = "."; } rsp.sendRedirect2(ref); }
/** * Changes the icon size by changing the cookie */ public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { String qs = req.getQueryString(); if (qs == null || !ICON_SIZE.matcher(qs).matches()) { throw new ServletException(); } Cookie cookie = new Cookie("iconSize", qs); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if (ref == null) { ref = "."; } rsp.sendRedirect2(ref); }
/** * Changes the icon size by changing the cookie */ public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { String qs = req.getQueryString(); if (qs == null || !ICON_SIZE.matcher(qs).matches()) { throw new ServletException(); } Cookie cookie = new Cookie("iconSize", qs); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if (ref == null) { ref = "."; } rsp.sendRedirect2(ref); }
/** * Changes the test result report display mode. */ public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { boolean failureOnly = false; // check the current preference value Cookie[] cookies = req.getCookies(); if(cookies!=null) { for (Cookie cookie : cookies) { if(cookie.getName().equals(FAILURE_ONLY_COOKIE)) failureOnly = Boolean.parseBoolean(cookie.getValue()); } } // flip! failureOnly = !failureOnly; // set the updated value Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly)); List anc = req.getAncestors(); Ancestor a = (Ancestor) anc.get(anc.size()-2); cookie.setPath(a.getUrl()); // just for this project cookie.setMaxAge(60*60*24*365); // 1 year rsp.addCookie(cookie); // back to the project page rsp.sendRedirect(".."); }
/** * Changes the icon size by changing the cookie */ public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { String qs = req.getQueryString(); if(qs==null) throw new ServletException(); Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs)); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if(ref==null) ref="."; rsp.sendRedirect2(ref); }
/** * Changes the test result report display mode. */ public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { boolean failureOnly = false; // check the current preference value Cookie[] cookies = req.getCookies(); if(cookies!=null) { for (Cookie cookie : cookies) { if(cookie.getName().equals(FAILURE_ONLY_COOKIE)) failureOnly = Boolean.parseBoolean(cookie.getValue()); } } // flip! failureOnly = !failureOnly; // set the updated value Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly)); List anc = req.getAncestors(); Ancestor a = (Ancestor) anc.get(anc.size()-2); cookie.setPath(a.getUrl()); // just for this project cookie.setMaxAge(60*60*24*365); // 1 year rsp.addCookie(cookie); // back to the project page rsp.sendRedirect(".."); }
/** * Changes the test result report display mode. */ public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { boolean failureOnly = false; // check the current preference value Cookie[] cookies = req.getCookies(); if(cookies!=null) { for (Cookie cookie : cookies) { if(cookie.getName().equals(FAILURE_ONLY_COOKIE)) failureOnly = Boolean.parseBoolean(cookie.getValue()); } } // flip! failureOnly = !failureOnly; // set the updated value Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly)); List anc = req.getAncestors(); Ancestor a = (Ancestor) anc.get(anc.size()-2); cookie.setPath(a.getUrl()); // just for this project cookie.setMaxAge(60*60*24*365); // 1 year rsp.addCookie(cookie); // back to the project page rsp.sendRedirect(".."); }
@Override protected void persistValue(final String value, final String pluginName, final StaplerRequest request, final StaplerResponse response) { Cookie cookie = createCookieHandler(pluginName).create(request.getAncestors(), value); response.addCookie(cookie); } }
@Override protected void persistValue(final String value, final String pluginName, final StaplerRequest request, final StaplerResponse response) { Cookie cookie = createCookieHandler(pluginName).create(request.getAncestors(), value); response.addCookie(cookie); } }
/** * Handles the logout processing. * <p/> * < * p/> * The default implementation erases the session and do a few other clean * up, then redirect the user to the URL specified by * {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); } Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); //Clear env property. EnvVars.clearHudsonUserEnvVar(); // reset remember-me cookie Cookie cookie = new Cookie(TokenBasedRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY, ""); cookie.setPath(Functions.getRequestRootPath(req).length() > 0 ? Functions.getRequestRootPath(req) : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req, auth)); }
/** * Handles the logout processing. * * <p> * The default implementation erases the session and do a few other clean up, then * redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if(session!=null) session.invalidate(); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); // reset remember-me cookie Cookie cookie = new Cookie(ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY,""); cookie.setPath(req.getContextPath().length()>0 ? req.getContextPath() : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req,auth)); }
/** * Handles the logout processing. * <p/> * <p/> * The default implementation erases the session and do a few other clean up, then * redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); } Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); //Clear env property. EnvVars.clearHudsonUserEnvVar(); // reset remember-me cookie Cookie cookie = new Cookie(ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, ""); cookie.setPath(req.getContextPath().length() > 0 ? req.getContextPath() : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req, auth)); }
/** * Handles the logout processing. * <p/> * <p/> * The default implementation erases the session and do a few other clean up, then * redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); } Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); //Clear env property. EnvVars.clearHudsonUserEnvVar(); // reset remember-me cookie Cookie cookie = new Cookie(TokenBasedRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY, ""); cookie.setPath(req.getContextPath().length() > 0 ? req.getContextPath() : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req, auth)); }
/** * Handles the logout processing. * <p/> * <p/> * The default implementation erases the session and do a few other clean up, then * redirect the user to the URL specified by {@link #getPostLogOutUrl(StaplerRequest, Authentication)}. * * @since 1.314 */ public void doLogout(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); } Authentication auth = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.clearContext(); //Clear env property. EnvVars.clearHudsonUserEnvVar(); // reset remember-me cookie Cookie cookie = new Cookie(ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, ""); cookie.setPath(req.getContextPath().length() > 0 ? req.getContextPath() : "/"); rsp.addCookie(cookie); rsp.sendRedirect2(getPostLogOutUrl(req, auth)); }
protected void persistValue(final String value, final StaplerRequest request, final StaplerResponse response) { // First check for URL values String buildCount = request.getParameter("buildCount"); if (buildCount != null) { setBuildCount(Integer.parseInt(buildCount)); setConfigType(GraphConfigurationDetail.BUILD_CONFIG); return; } String buildStep = request.getParameter("buildStep"); if (buildStep != null) { setBuildStep(Integer.parseInt(buildStep)); setConfigType(GraphConfigurationDetail.BUILDNTH_CONFIG); return; } // If not found, check cookie Cookie cookie = createCookieHandler("performance").create( request.getAncestors(), value); response.addCookie(cookie); }