Example usage for io.netty.handler.codec.http Cookie setVersion

List of usage examples for io.netty.handler.codec.http Cookie setVersion

Introduction

In this page you can find the example usage for io.netty.handler.codec.http Cookie setVersion.

Prototype

@Deprecated
void setVersion(int version);

Source Link

Document

Sets the version of this Cookie .

Usage

From source file:com.titilink.camel.rest.common.AdapterRestletUtil.java

License:LGPL

/**
 * ?Cookie//  www. ja v a2s .  c  om
 *
 * @param cookie
 * @return
 */
public static org.restlet.data.Cookie parseToRestletCookie(Cookie cookie) {
    if (null == cookie) {
        LOGGER.error("cookie=null");
        return null;
    }
    org.restlet.data.Cookie restletCookie = new org.restlet.data.Cookie();
    restletCookie.setDomain(cookie.getDomain());
    restletCookie.setVersion(cookie.getVersion());
    restletCookie.setName(cookie.getName());
    restletCookie.setValue(cookie.getValue());
    restletCookie.setPath(cookie.getPath());
    return restletCookie;
}

From source file:io.nebo.container.NettyHttpServletRequest.java

License:Apache License

@Override
public Cookie[] getCookies() {
    String cookieString = this.request.headers().get(COOKIE);
    if (cookieString != null) {
        Set<io.netty.handler.codec.http.Cookie> cookies = CookieDecoder.decode(cookieString);
        if (!cookies.isEmpty()) {
            Cookie[] cookiesArray = new Cookie[cookies.size()];
            int index = 0;
            for (io.netty.handler.codec.http.Cookie c : cookies) {
                Cookie cookie = new Cookie(c.getName(), c.getValue());
                cookie.setComment(c.getComment());
                if (c.getDomain() != null)
                    cookie.setDomain(c.getDomain());
                cookie.setMaxAge((int) c.getMaxAge());
                cookie.setPath(c.getPath());
                cookie.setSecure(c.isSecure());
                cookie.setVersion(c.getVersion());
                cookiesArray[index] = cookie;
                index++;/*from w ww .  j  av a 2 s  .c o  m*/
            }
            return cookiesArray;

        }
    }
    return new Cookie[0];
}