View Javadoc
1   /*
2    * ====================================================================
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   * ====================================================================
20   *
21   * This software consists of voluntary contributions made by many
22   * individuals on behalf of the Apache Software Foundation.  For more
23   * information on the Apache Software Foundation, please see
24   * <http://www.apache.org/>.
25   *
26   */
27  
28  package org.apache.hc.core5.http.support;
29  
30  import org.apache.hc.core5.http.Header;
31  import org.apache.hc.core5.http.ProtocolVersion;
32  import org.apache.hc.core5.http.message.BasicHttpRequest;
33  
34  /**
35   * Builder for {@link BasicHttpRequest} instances.
36   *
37   * @since 5.1
38   */
39  public abstract class AbstractResponseBuilder<T> extends AbstractMessageBuilder<T> {
40  
41      private int status;
42  
43      protected AbstractResponseBuilder(final int status) {
44          super();
45          this.status = status;
46      }
47  
48      public int getStatus() {
49          return status;
50      }
51  
52      public void setStatus(final int status) {
53          this.status = status;
54      }
55  
56      @Override
57      public AbstractResponseBuilder<T> setVersion(final ProtocolVersion version) {
58          super.setVersion(version);
59          return this;
60      }
61  
62      @Override
63      public AbstractResponseBuilder<T> setHeaders(final Header... headers) {
64          super.setHeaders(headers);
65          return this;
66      }
67  
68      @Override
69      public AbstractResponseBuilder<T> addHeader(final Header header) {
70          super.addHeader(header);
71          return this;
72      }
73  
74      @Override
75      public AbstractResponseBuilder<T> addHeader(final String name, final String value) {
76          super.addHeader(name, value);
77          return this;
78      }
79  
80      @Override
81      public AbstractResponseBuilder<T> removeHeader(final Header header) {
82          super.removeHeader(header);
83          return this;
84      }
85  
86      @Override
87      public AbstractResponseBuilder<T> removeHeaders(final String name) {
88          super.removeHeaders(name);
89          return this;
90      }
91  
92      @Override
93      public AbstractResponseBuilder<T> setHeader(final Header header) {
94          super.setHeader(header);
95          return this;
96      }
97  
98      @Override
99      public AbstractResponseBuilder<T> setHeader(final String name, final String value) {
100         super.setHeader(name, value);
101         return this;
102     }
103 
104     protected abstract T build();
105 
106 }