Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Added status code 308 #577

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions jaxrs-api/src/main/java/javax/ws/rs/core/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,21 @@ public static ResponseBuilder seeOther(URI location) {
public static ResponseBuilder temporaryRedirect(URI location) {
return status(Status.TEMPORARY_REDIRECT).location(location);
}

/**
* Create a new ResponseBuilder for a permanent redirection.
*
* @param location the redirection URI. If a relative URI is
* supplied it will be converted into an absolute URI by resolving it
* relative to the base URI of the application (see
* {@link UriInfo#getBaseUri}).
* @return a new response builder.
* @throws java.lang.IllegalArgumentException
* if location is {@code null}.
*/
public static ResponseBuilder permanentRedirect(URI location) {
return status(Status.PERMANENT_REDIRECT).location(location);
}

/**
* Create a new ResponseBuilder for a not acceptable response.
Expand Down Expand Up @@ -1320,6 +1335,10 @@ public enum Status implements StatusType {
* 307 Temporary Redirect, see {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.8">HTTP/1.1 documentation</a>}.
*/
TEMPORARY_REDIRECT(307, "Temporary Redirect"),
/**
* 308 Temporary Redirect, see {@link <a href="https://tools.ietf.org/html/rfc7538">HTTP/1.1 documentation</a>}.
*/
PERMANENT_REDIRECT(308, "Permanent Redirect"),
/**
* 400 Bad Request, see {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">HTTP/1.1 documentation</a>}.
*/
Expand Down