blob: b85023ab3e2cb9aaed735fa0d0b45685d960e552 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.restapi;
import com.yahoo.jdisc.Response;
import java.net.URI;
/**
* A HTTP redirect response
*
* @author bjorncs
*/
public class RedirectResponse extends MessageResponse {
private RedirectResponse(int statusCode, URI location) {
super(statusCode, "Moved to " + location.toString());
headers().add("Location", location.toString());
}
public static RedirectResponse found(URI location) {
return new RedirectResponse(Response.Status.FOUND, location);
}
public static RedirectResponse movedPermanently(URI location) {
return new RedirectResponse(Response.Status.MOVED_PERMANENTLY, location);
}
}
|