List of usage examples for javax.servlet.http HttpServletRequest getCookies
public Cookie[] getCookies();
Cookie
objects the client sent with this request. From source file:io.syndesis.credential.CredentialFlowStateHelper.java
static Set<CredentialFlowState> restoreFrom(final Restorer restore, final HttpServletRequest request) { final Cookie[] servletCookies = request.getCookies(); if (ArrayUtils.isEmpty(servletCookies)) { return Collections.emptySet(); }/*from w w w . ja v a2 s . c o m*/ final List<javax.ws.rs.core.Cookie> credentialCookies = Arrays.stream(servletCookies) .filter(c -> c.getName().startsWith(CredentialFlowState.CREDENTIAL_PREFIX)) .map(CredentialFlowStateHelper::toJaxRsCookie).collect(Collectors.toList()); try { return restore.apply(credentialCookies, CredentialFlowState.class); } catch (final IllegalArgumentException e) { return Collections.emptySet(); } }
From source file:org.apache.camel.example.gauth.TutorialController.java
private static String getAccessToken(HttpServletRequest request) { return getCookieValue(request.getCookies(), "TUTORIAL-ACCESS-TOKEN"); }
From source file:org.apache.camel.example.gauth.TutorialController.java
private static String getAccessTokenSecret(HttpServletRequest request) { return getCookieValue(request.getCookies(), "TUTORIAL-ACCESS-TOKEN-SECRET"); }
From source file:com.eryansky.common.web.utils.RequestUtil.java
public static Cookie getCookie(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); Cookie returnCookie = null;/*from w w w . ja v a 2s. c o m*/ if (cookies == null) { return returnCookie; } for (Cookie thisCookie : cookies) { if (thisCookie.getName().equals(name)) { if (!thisCookie.getValue().equals("")) { returnCookie = thisCookie; break; } } } return returnCookie; }
From source file:com.baifendian.swordfish.common.utils.http.HttpUtil.java
/** * ? cookie ?/*from w w w. j a v a 2 s . c o m*/ */ public static Cookie getCookieByName(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (StringUtils.equalsIgnoreCase(name, cookie.getName())) { return cookie; } } } return null; }
From source file:com.ieasy.basic.util.CookieSupport.java
/** * ?cookies/*from ww w . j av a 2s .c om*/ * * @param request * @param cookieName * @return */ public static final Cookie[] readCookies(HttpServletRequest request, String cookieName) { Cookie[] cookies = request.getCookies(); if (cookies == null || cookies.length == 0) return null; if (StringUtils.isEmpty(cookieName)) return cookies; for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals(cookieName)) return new Cookie[] { cookies[i] }; } return null; }
From source file:com.ieasy.basic.util.CookieSupport.java
/** * cookies/* w w w. j a v a 2 s.co m*/ * * @param request * @param response */ public static final void removeAllCookies(HttpServletRequest request, HttpServletResponse response) { Cookie[] cookies = request.getCookies(); if (cookies == null || cookies.length == 0) return; Map<String, String> cookiesMap = new HashMap<String, String>(); for (Cookie cookie : cookies) { cookiesMap.put(cookie.getName(), ""); } writeCookies(response, cookiesMap, 0); }
From source file:com.kamike.misc.CookieUtils.java
/** * * ?COOKIE//from w w w. j a va 2 s . c o m * * * * @param name * */ public static Cookie getCookie(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } for (Cookie ck : cookies) { if (StringUtils.equalsIgnoreCase(name, ck.getName())) { return ck; } } return null; }
From source file:com.kamike.misc.CookieUtils.java
/** * * ?COOKIE//from w ww .j av a2 s. c o m * * * * @param name * */ public static String getCookieValue(HttpServletRequest request, String name) { Cookie[] cookies = request.getCookies(); if (cookies == null) { return null; } for (Cookie ck : cookies) { if (StringUtils.equalsIgnoreCase(name, ck.getName())) { } } return null; }
From source file:net.mindengine.oculus.frontend.web.Auth.java
public static User getUserFromRequest(HttpServletRequest request) { Cookie cookies[] = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getName().equals("_u")) { User user = decodeUser(cookie.getValue()); return user; }/*w w w .j a v a 2s.co m*/ } } return null; }