Java Code Examples for io.undertow.server.HttpServerExchange#getRequestCookies()
The following examples show how to use
io.undertow.server.HttpServerExchange#getRequestCookies() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadBalancingProxyClient.java From lams with GNU General Public License v2.0 | 6 votes |
protected Host findStickyHost(HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getRequestCookies(); for (String cookieName : sessionCookieNames) { Cookie sk = cookies.get(cookieName); if (sk != null) { int index = sk.getValue().indexOf('.'); if (index == -1) { continue; } String route = sk.getValue().substring(index + 1); index = route.indexOf('.'); if (index != -1) { route = route.substring(0, index); } return routes.get(route); } } return null; }
Example 2
Source File: SessionCookieConfig.java From quarkus-http with Apache License 2.0 | 5 votes |
@Override public String findSessionId(final HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getRequestCookies(); if (cookies != null) { Cookie sessionId = cookies.get(cookieName); if (sessionId != null) { UndertowLogger.SESSION_LOGGER.tracef("Found session cookie session id %s on %s", sessionId, exchange); return sessionId.getValue(); } } return null; }
Example 3
Source File: ExtendedLoadBalancingProxyClient.java From galeb with Apache License 2.0 | 5 votes |
protected Iterator<CharSequence> parseRoutes(HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getRequestCookies(); for (String cookieName : sessionCookieNames) { Cookie sessionCookie = cookies.get(cookieName); if (sessionCookie != null) { return routeIteratorFactory.iterator(sessionCookie.getValue()); } } return routeIteratorFactory.iterator(null); }
Example 4
Source File: SessionCookieConfig.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public String findSessionId(final HttpServerExchange exchange) { Map<String, Cookie> cookies = exchange.getRequestCookies(); if (cookies != null) { Cookie sessionId = cookies.get(cookieName); if (sessionId != null) { UndertowLogger.SESSION_LOGGER.tracef("Found session cookie session id %s on %s", sessionId, exchange); return sessionId.getValue(); } } return null; }
Example 5
Source File: InboundCookiesHandler.java From mangooio with Apache License 2.0 | 5 votes |
/** * Retrieves the value of a cookie with a given name from a HttpServerExchange * * @param exchange The exchange containing the cookie * @param cookieName The name of the cookie * * @return The value of the cookie or null if none found */ private String getCookieValue(HttpServerExchange exchange, String cookieName) { String value = null; Map<String, Cookie> requestCookies = exchange.getRequestCookies(); if (requestCookies != null) { Cookie cookie = exchange.getRequestCookies().get(cookieName); if (cookie != null) { value = cookie.getValue(); } } return value; }
Example 6
Source File: Request.java From mangooio with Apache License 2.0 | 4 votes |
public Request(HttpServerExchange httpServerExchange) { Objects.requireNonNull(httpServerExchange, Required.HTTP_SERVER_EXCHANGE.toString()); this.httpServerExchange = httpServerExchange; this.cookies = (httpServerExchange.getRequestCookies() == null) ? new HashMap<>() : ImmutableMap.copyOf(httpServerExchange.getRequestCookies()); }