當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。