本文整理汇总了Java中io.undertow.server.handlers.Cookie.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Cookie.getValue方法的具体用法?Java Cookie.getValue怎么用?Java Cookie.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.undertow.server.handlers.Cookie
的用法示例。
在下文中一共展示了Cookie.getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttribute
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
@Override
public String readAttribute(final HttpServerExchange exchange) {
Cookie cookie = exchange.getRequestCookies().get(cookieName);
if (cookie == null) {
return null;
}
return cookie.getValue();
}
示例2: findSessionId
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
@Override
public String findSessionId(final HttpServerExchange exchange) {
Map<String, Cookie> cookies = exchange.getRequestCookies();
if (cookies != null) {
Cookie sessionId = cookies.get(cookieName);
if (sessionId != null) {
return sessionId.getValue();
}
}
return null;
}
示例3: wrap
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
@Override
public StreamSinkConduit wrap(ConduitFactory<StreamSinkConduit> factory, HttpServerExchange exchange) {
Cookie sessionId = exchange.getResponseCookies().get(sessionCookieName);
if (sessionId != null) {
StringBuilder sb = new StringBuilder(sessionId.getValue());
sb.append('.');
sb.append(jvmRoute);
sessionId.setValue(sb.toString());
}
return factory.create();
}
示例4: getCurrentSessionId
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
private String getCurrentSessionId(HttpServerExchange exchange) {
if (exchange == null && ServletRequestContext.current() != null) {
exchange = ServletRequestContext.current().getExchange();
}
if (exchange == null) return null;
Cookie sessionCookie = exchange.getRequestCookies().get("JSESSIONID");
if (sessionCookie == null) return null;
return sessionCookie.getValue();
}
示例5: getCookieValue
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
/**
* 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;
final Cookie cookie = exchange.getRequestCookies().get(cookieName);
if (cookie != null) {
value = cookie.getValue();
}
return value;
}
示例6: authenticate
import io.undertow.server.handlers.Cookie; //导入方法依赖的package包/类
@Override
public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) {
Cookie cookie = exchange.getRequestCookies().get(cookieName);
if (cookie != null) {
final String ssoId = cookie.getValue();
try (SingleSignOn sso = this.manager.findSingleSignOn(ssoId)) {
if (sso != null) {
Account verified = securityContext.getIdentityManager().verify(sso.getAccount());
if (verified == null) {
//we return not attempted here to allow other mechanisms to proceed as normal
return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
}
final Session session = getSession(exchange);
registerSessionIfRequired(sso, session);
securityContext.authenticationComplete(verified, sso.getMechanismName(), false);
securityContext.registerNotificationReceiver(new NotificationReceiver() {
@Override
public void handleNotification(SecurityNotification notification) {
if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) {
manager.removeSingleSignOn(ssoId);
}
}
});
return AuthenticationMechanismOutcome.AUTHENTICATED;
}
}
clearSsoCookie(exchange);
}
exchange.addResponseWrapper(responseListener);
return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
}