diff --git a/jaxrs-api/src/main/java/javax/ws/rs/core/Response.java b/jaxrs-api/src/main/java/javax/ws/rs/core/Response.java index e1ba1ed..f43086c 100644 --- a/jaxrs-api/src/main/java/javax/ws/rs/core/Response.java +++ b/jaxrs-api/src/main/java/javax/ws/rs/core/Response.java @@ -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. @@ -1320,6 +1335,10 @@ public enum Status implements StatusType { * 307 Temporary Redirect, see {@link HTTP/1.1 documentation}. */ TEMPORARY_REDIRECT(307, "Temporary Redirect"), + /** + * 308 Temporary Redirect, see {@link HTTP/1.1 documentation}. + */ + PERMANENT_REDIRECT(308, "Permanent Redirect"), /** * 400 Bad Request, see {@link HTTP/1.1 documentation}. */