001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2009 Sun Microsystems Inc.
015 * Portions Copyright 2010–2011 ApexIdentity Inc.
016 * Portions Copyright 2011-2014 ForgeRock AS.
017 */
018
019package org.forgerock.openig.http;
020
021/**
022 * A response message.
023 */
024public final class Response extends Message<Response> {
025    /** The response status reason. */
026    private String reason;
027
028    /** The response status code. */
029    private Integer status;
030
031    /**
032     * Creates a new response.
033     */
034    public Response() {
035        // Nothing to do.
036    }
037
038    /**
039     * Returns the response status reason.
040     *
041     * @return The response status reason.
042     */
043    public String getReason() {
044        return reason;
045    }
046
047    /**
048     * Returns the response status code.
049     *
050     * @return The response status code.
051     */
052    public Integer getStatus() {
053        return status;
054    }
055
056    /**
057     * Sets the response status reason.
058     *
059     * @param reason
060     *            The response status reason.
061     * @return This response.
062     */
063    public Response setReason(final String reason) {
064        this.reason = reason;
065        return this;
066    }
067
068    /**
069     * Sets the response status code.
070     *
071     * @param status
072     *            The response status code.
073     * @return This response.
074     */
075    public Response setStatus(final Integer status) {
076        this.status = status;
077        return this;
078    }
079
080    @Override
081    Response thisMessage() {
082        return this;
083    }
084}