001package com.box.sdk;
002
003import java.net.HttpURLConnection;
004import java.net.URL;
005
006/**
007 * Used to read HTTP responses containing redirect URLs in the 'LOCATION' header.
008 *
009 * <p>This request type extends BoxAPIResponse to provide additional functionality for handling redirect URLs.</p>
010 */
011public class BoxRedirectResponse extends BoxAPIResponse {
012
013    private URL redirectURL;
014
015    /**
016     * Constructs a BoxRedirectResponse without an associated HttpURLConnection.
017     */
018    public BoxRedirectResponse() {
019        super();
020    }
021
022    /**
023     * Constructs a BoxRedirectResponse using an HttpURLConnection.
024     * @param  connection a connection that has already sent a request to the API.
025     */
026    public BoxRedirectResponse(HttpURLConnection connection) {
027        super(connection);
028    }
029
030    /**
031     * Sets the redirectURL for this response.
032     * @param redirectURL the redirect URL
033     */
034    public void setRedirectURL(URL redirectURL) {
035        this.redirectURL = redirectURL;
036    }
037
038    /**
039     * Gets the redirect URL for this response.
040     * @return redirectURL
041     */
042    public URL getRedirectURL() {
043        return this.redirectURL;
044    }
045
046}