当前位置: 首页>>代码示例>>Java>>正文


Java Cookie.value方法代码示例

本文整理汇总了Java中io.netty.handler.codec.http.cookie.Cookie.value方法的典型用法代码示例。如果您正苦于以下问题:Java Cookie.value方法的具体用法?Java Cookie.value怎么用?Java Cookie.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.handler.codec.http.cookie.Cookie的用法示例。


在下文中一共展示了Cookie.value方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUser

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
/**
 * 从Http Cookie中获取用户Id
 * 
 * @param data
 * @return
 */
public static final PushUser getUser(HandshakeData data) {
    String _cookie = data.getSingleHeader(HttpHeaders.Names.COOKIE);
    if (_cookie != null) {
        Set<Cookie> cookies = ServerCookieDecoder.LAX.decode(_cookie);
        for (Cookie cookie : cookies) {
            if (TokenManager.LOGIN_COOKIE_NAME.equals(cookie.name())) {
                String value = cookie.value();
                if (value != null) {
                    return getUserIdFromCookie(value);
                }
            }
        }
    }
    return null;
}
 
开发者ID:bridgeli,项目名称:netty-socketio-demo,代码行数:22,代码来源:CookieUserAuthorizationListener.java

示例2: onRequestReceived

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
@Override
public void onRequestReceived(ChannelHandlerContext ctx, HttpRequest request) {

    HttpSessionThreadLocal.unset();

    Collection<Cookie> cookies = Utils.getCookies(HttpSessionImpl.SESSION_ID_KEY, request);
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            String jsessionId = cookie.value();
            HttpSession s = HttpSessionThreadLocal.getSessionStore().findSession(jsessionId);
            if (s != null) {
                HttpSessionThreadLocal.set(s);
                this.sessionRequestedByCookie = true;
                break;
            }
        }
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:19,代码来源:HttpSessionInterceptor.java

示例3: extract

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
@Override
public String extract(ObjectNode node, RakamHttpRequest request)
{
    for (Cookie cookie : request.cookies()) {
        if (name.equals(cookie.name())) {
            // TODO fixme: the value of cookie parameter always must be String.
            return cookie.value();
        }
    }

    if (required) {
        throw new HttpRequestException("'" + name + "' cookie is required.", BAD_REQUEST);
    }

    return null;
}
 
开发者ID:buremba,项目名称:netty-rest,代码行数:17,代码来源:IRequestParameter.java

示例4: getUserFromCookie

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
public User getUserFromCookie(FullHttpRequest request) {
    String cookieString = request.headers().get(HttpHeaderNames.COOKIE);

    if (cookieString != null) {
        Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
        if (!cookies.isEmpty()) {
            for (Cookie cookie : cookies) {
                if (isValid(cookie)) {
                    String token = cookie.value();
                    return httpSession.get(token);
                }
            }
        }
    }

    return null;
}
 
开发者ID:blynkkk,项目名称:blynk-server,代码行数:18,代码来源:SessionDao.java

示例5: getSessionId

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
@Nullable
String getSessionId(CommonRequest request) throws Exception {
    String cookieHeader = request.getHeader(HttpHeaderNames.COOKIE);
    if (cookieHeader == null) {
        return null;
    }
    Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieHeader);
    for (Cookie cookie : cookies) {
        if (cookie.name().equals(configRepository.getWebConfig().sessionCookieName())) {
            return cookie.value();
        }
    }
    return null;
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:15,代码来源:HttpSessionManager.java

示例6: getCookieValue

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
@Override
public String getCookieValue(String cookieName) {
    Cookie cookie = cookies.get(cookieName);
    return (cookie == null) ? null : cookie.value();
}
 
开发者ID:wso2-attic,项目名称:carbon-uuf,代码行数:6,代码来源:MicroserviceHttpRequest.java

示例7: getCookieValue

import io.netty.handler.codec.http.cookie.Cookie; //导入方法依赖的package包/类
/**
 * 获取Cookie的值
 * @param request HttpRequest
 * @param name cookie名字
 * @return
 */
public static String getCookieValue(HttpRequest request,String name){
    Cookie cookie = getCookie(request,name);
    return cookie.value();
}
 
开发者ID:all4you,项目名称:redant,代码行数:11,代码来源:CookieHelper.java


注:本文中的io.netty.handler.codec.http.cookie.Cookie.value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。