List of usage examples for javax.servlet.http Cookie getValue
public String getValue()
From source file:org.jasig.cas.web.support.CookieRetrievingCookieGeneratorTests.java
public void testCookieAddWithoutRememberMe() { final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); this.g.addCookie(request, response, "test"); final Cookie c = response.getCookie("test"); assertEquals(5, c.getMaxAge());/*from w w w .j ava2s . c o m*/ assertEquals("test", c.getValue()); }
From source file:com.google.acre.script.AcreCookie.java
public AcreCookie(Cookie servlet_cookie) { name = servlet_cookie.getName();/* w w w .j ava 2s . c o m*/ value = servlet_cookie.getValue(); domain = servlet_cookie.getDomain(); path = servlet_cookie.getPath(); secure = servlet_cookie.getSecure(); max_age = servlet_cookie.getMaxAge(); }
From source file:com.afousan.controller.CookieInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // all non-root requests get analyzed Cookie[] cookies = request.getCookies(); if (!ObjectUtils.isEmpty(cookies)) { for (Cookie cookie : cookies) { if (RETWIS_COOKIE.equals(cookie.getName())) { String auth = cookie.getValue(); String name = twitter.findNameForAuth(auth); if (name != null) { String uid = twitter.findUid(name); RetwisSecurity.setUser(name, uid); }/* w w w .j a v a2s. co m*/ } } } return true; }
From source file:com.bennavetta.appsite.serve.HttpServletReq.java
@Override public String getCookie(String name) { for (Cookie cookie : request.getCookies()) { if (cookie.getName().equals(name)) { return cookie.getValue(); }//w ww .j a v a2 s . c om } return ""; }
From source file:org.jasig.cas.web.support.CookieRetrievingCookieGeneratorTests.java
public void testCookieAddWithRememberMe() { final MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter(RememberMeCredentials.REQUEST_PARAMETER_REMEMBER_ME, "true"); final MockHttpServletResponse response = new MockHttpServletResponse(); this.g.addCookie(request, response, "test"); final Cookie c = response.getCookie("test"); assertEquals(100, c.getMaxAge());/*from www . j a va 2 s. co m*/ assertEquals("test", c.getValue()); }
From source file:de.adorsys.oauth.authdispatcher.matcher.RememberMeAuthMatcher.java
private Cookie getCookieToken(String clientId, HttpServletRequest request) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; }/* w w w.ja v a 2s. co m*/ for (Cookie cookie : cookies) { if (cookie.getName().equals("REMEMBER_" + clientId) && StringUtils.isNotEmpty(cookie.getValue())) { return cookie; } } return null; }
From source file:webim.service.WebimVisitorManager.java
private String findVid(HttpServletRequest request) { Cookie cookie = findCookie(request, COOKIE_VID); if (cookie != null) { return cookie.getValue(); }//from w ww . j ava 2 s . c o m return null; }
From source file:SettingandReadingCookies.java
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<HTML>"); out.println("<HEAD>"); out.println("<TITLE>"); out.println("A Web Page"); out.println("</TITLE>"); out.println("</HEAD>"); out.println("<BODY"); Cookie[] cookies = request.getCookies(); boolean foundCookie = false; for (int loopIndex = 0; loopIndex < cookies.length; loopIndex++) { Cookie cookie1 = cookies[loopIndex]; if (cookie1.getName().equals("color")) { out.println("bgcolor = " + cookie1.getValue()); foundCookie = true;/*from w ww . j a v a 2 s. c o m*/ } } if (!foundCookie) { Cookie cookie1 = new Cookie("color", "cyan"); cookie1.setMaxAge(24 * 60 * 60); response.addCookie(cookie1); } out.println(">"); out.println("<H1>Setting and Reading Cookies</H1>"); out.println("This page will set its background color using a cookie when reloaded."); out.println("</BODY>"); out.println("</HTML>"); }
From source file:org.glassmaker.spring.oauth.OAuth2LogoutFilter.java
protected String getCookieValue(HttpServletRequest request, String cookieName) { String cookieValue = null;/*from w ww . j a v a 2 s.co m*/ Cookie[] cookies = request.getCookies(); if (cookies != null) for (Cookie cookie : cookies) if (cookie.getName().equals(cookieName)) { cookieValue = cookie.getValue(); break; } return cookieValue; }
From source file:org.impalaframework.extension.mvc.annotation.resolver.CookieValueArgumentResolver.java
protected Object getValue(NativeWebRequest webRequest, String attributeName) { HttpServletRequest request = ObjectUtils.cast(webRequest.getNativeRequest(), HttpServletRequest.class); final Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; }/* w w w.j ava2 s. c o m*/ for (Cookie cookie : cookies) { final String name = cookie.getName(); if (name.equals(attributeName)) { return cookie.getValue(); } } return null; }