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


Java Cookie.DEFAULT_VERSION属性代码示例

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


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

示例1: newDeletedCookie

/**
 * <p>newDeletedCookie.</p>
 *
 * @param name a {@link java.lang.String} object.
 * @return a {@link javax.ws.rs.core.NewCookie} object.
 */
public static NewCookie newDeletedCookie(String name) {
    /**
     * Create a new instance.
     *
     * @param name     the name of the cookie
     * @param value    the value of the cookie
     * @param path     the URI path for which the cookie is valid
     * @param domain   the host domain for which the cookie is valid
     * @param version  the version of the specification to which the cookie complies
     * @param comment  the comment
     * @param maxAge   the maximum age of the cookie in seconds
     * @param expiry   the cookie expiry date.
     * @param secure   specifies whether the cookie will only be sent over a secure connection
     * @param httpOnly if {@code true} make the cookie HTTP only, i.e. only visible as part of an HTTP request.
     * @throws IllegalArgumentException if name is {@code null}.
     * @since 2.0
     */
    return new NewCookie(name, DELETED_COOKIE_VALUE, "/", null, Cookie.DEFAULT_VERSION, null, 0, null, false, true);
}
 
开发者ID:icode,项目名称:ameba-utils,代码行数:25,代码来源:Cookies.java

示例2: newHttpOnlyCookie

/**
 * <p>newHttpOnlyCookie.</p>
 *
 * @param name  a {@link java.lang.String} object.
 * @param value a {@link java.lang.String} object.
 * @return a {@link javax.ws.rs.core.NewCookie} object.
 */
public static NewCookie newHttpOnlyCookie(String name, String value) {
    /**
     * Create a new instance.
     *
     * @param name     the name of the cookie
     * @param value    the value of the cookie
     * @param path     the URI path for which the cookie is valid
     * @param domain   the host domain for which the cookie is valid
     * @param version  the version of the specification to which the cookie complies
     * @param comment  the comment
     * @param maxAge   the maximum age of the cookie in seconds
     * @param expiry   the cookie expiry date.
     * @param secure   specifies whether the cookie will only be sent over a secure connection
     * @param httpOnly if {@code true} make the cookie HTTP only, i.e. only visible as part of an HTTP request.
     * @throws IllegalArgumentException if name is {@code null}.
     * @since 2.0
     */
    return new NewCookie(name, value, null, null, Cookie.DEFAULT_VERSION, null, -1, null, false, true);
}
 
开发者ID:icode,项目名称:ameba-utils,代码行数:26,代码来源:Cookies.java

示例3: toString

@Override
public String toString(Cookie cookie) {
    StringBuilder sb = new StringBuilder();

    if (cookie.getVersion() != Cookie.DEFAULT_VERSION) {
        sb.append(VERSION).append('=').append(cookie.getVersion()).append(';');
    }
    sb.append(cookie.getName()).append('=').append(cookie.getValue());
    if (cookie.getPath() != null) {
        sb.append(';').append(PATH).append('=').append(cookie.getPath());
    }
    if (cookie.getDomain() != null) {
        sb.append(';').append(DOMAIN).append('=').append(cookie.getDomain());
    }
    if (cookie instanceof NewCookie) {
        NewCookie newCookie = (NewCookie) cookie;
        if (newCookie.getMaxAge() != NewCookie.DEFAULT_MAX_AGE) {
            sb.append(';').append(MAX_AGE).append('=').append(newCookie.getMaxAge());
        }
        if (newCookie.getComment() != null) {
            sb.append(';').append(COMMENT).append('=').append(newCookie.getComment());
        }
        if (newCookie.getExpiry() != null) {
            //All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT)
            dateFormat.setTimeZone(TimeZone.getTimeZone(GMT_TIMEZONE));
            sb.append(';').append(EXPIRES).append('=').append(dateFormat.format(newCookie.getExpiry()));
        }
        if (newCookie.isSecure()) {
            sb.append(';').append(SECURE);
        }
        if (newCookie.isHttpOnly()) {
            sb.append(';').append(HTTP_ONLY);
        }
    }
    return sb.toString();
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:36,代码来源:CookieHeaderProvider.java

示例4: createToken

@Override
public void createToken(String token) {
    NewCookie cookie = new NewCookie(
            SESSION_ID_KEY,
            token,
            "/",
            null,
            Cookie.DEFAULT_VERSION,
            null,
            SessionFeature.CLIENT_MAX_AGE,
            null,
            Requests.getSecurityContext().isSecure(),
            true);
    Requests.setProperty(SET_COOKIE_KEY, cookie);
}
 
开发者ID:icode,项目名称:ameba-session,代码行数:15,代码来源:SessionClientCookieStore.java

示例5: logout

@Override
public Response logout(String token, Cookie tokenAccessCookie, UriInfo uriInfo) {
    NewCookie newCookie = new NewCookie(AdaptiveEnvironmentFilter.COOKIE_NAME, COOKIE_DELETE_VALUE, "/", null, Cookie.DEFAULT_VERSION, null, 1, new Date(0), false, false);
    return Response.ok().cookie(newCookie).build();
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:5,代码来源:AdaptiveAuthenticationDao.java

示例6: addCookie

/**
 * Return the generated hash as cookie
 * 
 * @param rb
 *            The {@link ResponseBuilder} to complete.
 * @param login
 *            User login used to match the hash.
 * @param hash
 *            The cookie value also stored in data base.
 * @return the {@link ResponseBuilder} including cookie value. Same object
 *         than the original parameter.
 */
public ResponseBuilder addCookie(final ResponseBuilder rb, final String login, final String hash) {
	if (hash != null) {
		// There is a preference, add it to a cookie
		final Date expire = new Date(System.currentTimeMillis() + COOKIE_AGE * DateUtils.MILLIS_PER_SECOND);
		final NewCookie cookieHash = new NewCookie(PREFERRED_COOKIE_HASH, login + "|" + hash, "/", null, Cookie.DEFAULT_VERSION, null,
				COOKIE_AGE, expire, true, true);
		rb.cookie(cookieHash);
	}
	return rb;
}
 
开发者ID:ligoj,项目名称:plugin-redirect,代码行数:22,代码来源:RedirectResource.java


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