001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.http.response;
018
019import static org.apache.juneau.http.response.NonAuthoritiveInformation.*;
020
021import java.net.*;
022import java.util.*;
023
024import org.apache.http.*;
025import org.apache.http.Header;
026import org.apache.juneau.annotation.*;
027import org.apache.juneau.http.*;
028import org.apache.juneau.http.annotation.*;
029import org.apache.juneau.http.header.*;
030
031/**
032 * Represents an <c>HTTP 203 Non-Authoritative Information</c> response.
033 *
034 * <p>
035 * The server is a transforming proxy (e.g. a Web accelerator) that received a 200 OK from its origin, but is returning a modified version of the origin's response.
036 *
037 * <h5 class='section'>See Also:</h5><ul>
038 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a>
039 * </ul>
040 */
041@Response
042@StatusCode(STATUS_CODE)
043@Schema(description = REASON_PHRASE)
044public class NonAuthoritiveInformation extends BasicHttpResponse {
045
046   /** HTTP status code */
047   public static final int STATUS_CODE = 203;
048
049   /** Reason phrase */
050   public static final String REASON_PHRASE = "Non-Authoritative Information";
051
052   /** Default status line */
053   private static final BasicStatusLine STATUS_LINE = BasicStatusLine.create(STATUS_CODE, REASON_PHRASE);
054
055   /** Default unmodifiable instance */
056   public static final NonAuthoritiveInformation INSTANCE = new NonAuthoritiveInformation().setUnmodifiable();
057
058   /**
059    * Constructor.
060    */
061   public NonAuthoritiveInformation() {
062      super(STATUS_LINE);
063   }
064
065   /**
066    * Constructor.
067    *
068    * <p>
069    * This is the constructor used when parsing an HTTP response.
070    *
071    * @param response The HTTP response to copy from.  Must not be <jk>null</jk>.
072    * @throws AssertionError If HTTP response status code does not match what was expected.
073    */
074   public NonAuthoritiveInformation(HttpResponse response) {
075      super(response);
076      assertStatusCode(response);
077   }
078
079   /**
080    * Copy constructor.
081    *
082    * @param copyFrom The bean to copy from.
083    */
084   public NonAuthoritiveInformation(NonAuthoritiveInformation copyFrom) {
085      super(copyFrom);
086   }
087
088   /**
089    * Creates a builder for this class initialized with the contents of this bean.
090    *
091    * @return A new builder bean.
092    */
093   public NonAuthoritiveInformation copy() {
094      return new NonAuthoritiveInformation(this);
095   }
096
097   @Override /* Overridden from BasicHttpResponse */
098   public NonAuthoritiveInformation setContent(HttpEntity value) {
099      super.setContent(value);
100      return this;
101   }
102
103   @Override /* Overridden from BasicHttpResponse */
104   public NonAuthoritiveInformation setContent(String value) {
105      super.setContent(value);
106      return this;
107   }
108
109   @Override /* Overridden from BasicHttpResponse */
110   public NonAuthoritiveInformation setHeader2(Header value) {
111      super.setHeader2(value);
112      return this;
113   }
114
115   @Override /* Overridden from BasicHttpResponse */
116   public NonAuthoritiveInformation setHeader2(String name, String value) {
117      super.setHeader2(name, value);
118      return this;
119   }
120
121   @Override /* Overridden from BasicHttpResponse */
122   public NonAuthoritiveInformation setHeaders(HeaderList value) {
123      super.setHeaders(value);
124      return this;
125   }
126
127   @Override /* Overridden from BasicHttpResponse */
128   public NonAuthoritiveInformation setHeaders(List<Header> values) {
129      super.setHeaders(values);
130      return this;
131   }
132
133   @Override /* Overridden from BasicHttpResponse */
134   public NonAuthoritiveInformation setHeaders2(Header...values) {
135      super.setHeaders2(values);
136      return this;
137   }
138
139   @Override /* Overridden from BasicHttpResponse */
140   public NonAuthoritiveInformation setLocale2(Locale value) {
141      super.setLocale2(value);
142      return this;
143   }
144
145   @Override /* Overridden from BasicHttpResponse */
146   public NonAuthoritiveInformation setLocation(String value) {
147      super.setLocation(value);
148      return this;
149   }
150
151   @Override /* Overridden from BasicHttpResponse */
152   public NonAuthoritiveInformation setLocation(URI value) {
153      super.setLocation(value);
154      return this;
155   }
156
157   @Override /* Overridden from BasicHttpResponse */
158   public NonAuthoritiveInformation setProtocolVersion(ProtocolVersion value) {
159      super.setProtocolVersion(value);
160      return this;
161   }
162
163   @Override /* Overridden from BasicHttpResponse */
164   public NonAuthoritiveInformation setReasonPhrase2(String value) {
165      super.setReasonPhrase2(value);
166      return this;
167   }
168
169   @Override /* Overridden from BasicHttpResponse */
170   public NonAuthoritiveInformation setReasonPhraseCatalog(ReasonPhraseCatalog value) {
171      super.setReasonPhraseCatalog(value);
172      return this;
173   }
174
175   @Override /* Overridden from BasicHttpResponse */
176   public NonAuthoritiveInformation setStatusCode2(int value) {
177      super.setStatusCode2(value);
178      return this;
179   }
180
181   @Override /* Overridden from BasicHttpResponse */
182   public NonAuthoritiveInformation setStatusLine(BasicStatusLine value) {
183      super.setStatusLine(value);
184      return this;
185   }
186
187   @Override /* Overridden from BasicHttpResponse */
188   public NonAuthoritiveInformation setUnmodifiable() {
189      super.setUnmodifiable();
190      return this;
191   }
192}