Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | * ==================================================================== |
michael@0 | 3 | * Licensed to the Apache Software Foundation (ASF) under one |
michael@0 | 4 | * or more contributor license agreements. See the NOTICE file |
michael@0 | 5 | * distributed with this work for additional information |
michael@0 | 6 | * regarding copyright ownership. The ASF licenses this file |
michael@0 | 7 | * to you under the Apache License, Version 2.0 (the |
michael@0 | 8 | * "License"); you may not use this file except in compliance |
michael@0 | 9 | * with the License. You may obtain a copy of the License at |
michael@0 | 10 | * |
michael@0 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 12 | * |
michael@0 | 13 | * Unless required by applicable law or agreed to in writing, |
michael@0 | 14 | * software distributed under the License is distributed on an |
michael@0 | 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
michael@0 | 16 | * KIND, either express or implied. See the License for the |
michael@0 | 17 | * specific language governing permissions and limitations |
michael@0 | 18 | * under the License. |
michael@0 | 19 | * ==================================================================== |
michael@0 | 20 | * |
michael@0 | 21 | * This software consists of voluntary contributions made by many |
michael@0 | 22 | * individuals on behalf of the Apache Software Foundation. For more |
michael@0 | 23 | * information on the Apache Software Foundation, please see |
michael@0 | 24 | * <http://www.apache.org/>. |
michael@0 | 25 | * |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | package ch.boye.httpclientandroidlib; |
michael@0 | 29 | |
michael@0 | 30 | import ch.boye.httpclientandroidlib.params.HttpParams; |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * HTTP messages consist of requests from client to server and responses |
michael@0 | 34 | * from server to client. |
michael@0 | 35 | * <pre> |
michael@0 | 36 | * HTTP-message = Request | Response ; HTTP/1.1 messages |
michael@0 | 37 | * </pre> |
michael@0 | 38 | * <p> |
michael@0 | 39 | * HTTP messages use the generic message format of RFC 822 for |
michael@0 | 40 | * transferring entities (the payload of the message). Both types |
michael@0 | 41 | * of message consist of a start-line, zero or more header fields |
michael@0 | 42 | * (also known as "headers"), an empty line (i.e., a line with nothing |
michael@0 | 43 | * preceding the CRLF) indicating the end of the header fields, |
michael@0 | 44 | * and possibly a message-body. |
michael@0 | 45 | * </p> |
michael@0 | 46 | * <pre> |
michael@0 | 47 | * generic-message = start-line |
michael@0 | 48 | * *(message-header CRLF) |
michael@0 | 49 | * CRLF |
michael@0 | 50 | * [ message-body ] |
michael@0 | 51 | * start-line = Request-Line | Status-Line |
michael@0 | 52 | * </pre> |
michael@0 | 53 | * |
michael@0 | 54 | * @since 4.0 |
michael@0 | 55 | */ |
michael@0 | 56 | public interface HttpMessage { |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * Returns the protocol version this message is compatible with. |
michael@0 | 60 | */ |
michael@0 | 61 | ProtocolVersion getProtocolVersion(); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * Checks if a certain header is present in this message. Header values are |
michael@0 | 65 | * ignored. |
michael@0 | 66 | * |
michael@0 | 67 | * @param name the header name to check for. |
michael@0 | 68 | * @return true if at least one header with this name is present. |
michael@0 | 69 | */ |
michael@0 | 70 | boolean containsHeader(String name); |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * Returns all the headers with a specified name of this message. Header values |
michael@0 | 74 | * are ignored. Headers are orderd in the sequence they will be sent over a |
michael@0 | 75 | * connection. |
michael@0 | 76 | * |
michael@0 | 77 | * @param name the name of the headers to return. |
michael@0 | 78 | * @return the headers whose name property equals <code>name</code>. |
michael@0 | 79 | */ |
michael@0 | 80 | Header[] getHeaders(String name); |
michael@0 | 81 | |
michael@0 | 82 | /** |
michael@0 | 83 | * Returns the first header with a specified name of this message. Header |
michael@0 | 84 | * values are ignored. If there is more than one matching header in the |
michael@0 | 85 | * message the first element of {@link #getHeaders(String)} is returned. |
michael@0 | 86 | * If there is no matching header in the message <code>null</code> is |
michael@0 | 87 | * returned. |
michael@0 | 88 | * |
michael@0 | 89 | * @param name the name of the header to return. |
michael@0 | 90 | * @return the first header whose name property equals <code>name</code> |
michael@0 | 91 | * or <code>null</code> if no such header could be found. |
michael@0 | 92 | */ |
michael@0 | 93 | Header getFirstHeader(String name); |
michael@0 | 94 | |
michael@0 | 95 | /** |
michael@0 | 96 | * Returns the last header with a specified name of this message. Header values |
michael@0 | 97 | * are ignored. If there is more than one matching header in the message the |
michael@0 | 98 | * last element of {@link #getHeaders(String)} is returned. If there is no |
michael@0 | 99 | * matching header in the message <code>null</code> is returned. |
michael@0 | 100 | * |
michael@0 | 101 | * @param name the name of the header to return. |
michael@0 | 102 | * @return the last header whose name property equals <code>name</code>. |
michael@0 | 103 | * or <code>null</code> if no such header could be found. |
michael@0 | 104 | */ |
michael@0 | 105 | Header getLastHeader(String name); |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * Returns all the headers of this message. Headers are orderd in the sequence |
michael@0 | 109 | * they will be sent over a connection. |
michael@0 | 110 | * |
michael@0 | 111 | * @return all the headers of this message |
michael@0 | 112 | */ |
michael@0 | 113 | Header[] getAllHeaders(); |
michael@0 | 114 | |
michael@0 | 115 | /** |
michael@0 | 116 | * Adds a header to this message. The header will be appended to the end of |
michael@0 | 117 | * the list. |
michael@0 | 118 | * |
michael@0 | 119 | * @param header the header to append. |
michael@0 | 120 | */ |
michael@0 | 121 | void addHeader(Header header); |
michael@0 | 122 | |
michael@0 | 123 | /** |
michael@0 | 124 | * Adds a header to this message. The header will be appended to the end of |
michael@0 | 125 | * the list. |
michael@0 | 126 | * |
michael@0 | 127 | * @param name the name of the header. |
michael@0 | 128 | * @param value the value of the header. |
michael@0 | 129 | */ |
michael@0 | 130 | void addHeader(String name, String value); |
michael@0 | 131 | |
michael@0 | 132 | /** |
michael@0 | 133 | * Overwrites the first header with the same name. The new header will be appended to |
michael@0 | 134 | * the end of the list, if no header with the given name can be found. |
michael@0 | 135 | * |
michael@0 | 136 | * @param header the header to set. |
michael@0 | 137 | */ |
michael@0 | 138 | void setHeader(Header header); |
michael@0 | 139 | |
michael@0 | 140 | /** |
michael@0 | 141 | * Overwrites the first header with the same name. The new header will be appended to |
michael@0 | 142 | * the end of the list, if no header with the given name can be found. |
michael@0 | 143 | * |
michael@0 | 144 | * @param name the name of the header. |
michael@0 | 145 | * @param value the value of the header. |
michael@0 | 146 | */ |
michael@0 | 147 | void setHeader(String name, String value); |
michael@0 | 148 | |
michael@0 | 149 | /** |
michael@0 | 150 | * Overwrites all the headers in the message. |
michael@0 | 151 | * |
michael@0 | 152 | * @param headers the array of headers to set. |
michael@0 | 153 | */ |
michael@0 | 154 | void setHeaders(Header[] headers); |
michael@0 | 155 | |
michael@0 | 156 | /** |
michael@0 | 157 | * Removes a header from this message. |
michael@0 | 158 | * |
michael@0 | 159 | * @param header the header to remove. |
michael@0 | 160 | */ |
michael@0 | 161 | void removeHeader(Header header); |
michael@0 | 162 | |
michael@0 | 163 | /** |
michael@0 | 164 | * Removes all headers with a certain name from this message. |
michael@0 | 165 | * |
michael@0 | 166 | * @param name The name of the headers to remove. |
michael@0 | 167 | */ |
michael@0 | 168 | void removeHeaders(String name); |
michael@0 | 169 | |
michael@0 | 170 | /** |
michael@0 | 171 | * Returns an iterator of all the headers. |
michael@0 | 172 | * |
michael@0 | 173 | * @return Iterator that returns Header objects in the sequence they are |
michael@0 | 174 | * sent over a connection. |
michael@0 | 175 | */ |
michael@0 | 176 | HeaderIterator headerIterator(); |
michael@0 | 177 | |
michael@0 | 178 | /** |
michael@0 | 179 | * Returns an iterator of the headers with a given name. |
michael@0 | 180 | * |
michael@0 | 181 | * @param name the name of the headers over which to iterate, or |
michael@0 | 182 | * <code>null</code> for all headers |
michael@0 | 183 | * |
michael@0 | 184 | * @return Iterator that returns Header objects with the argument name |
michael@0 | 185 | * in the sequence they are sent over a connection. |
michael@0 | 186 | */ |
michael@0 | 187 | HeaderIterator headerIterator(String name); |
michael@0 | 188 | |
michael@0 | 189 | /** |
michael@0 | 190 | * Returns the parameters effective for this message as set by |
michael@0 | 191 | * {@link #setParams(HttpParams)}. |
michael@0 | 192 | */ |
michael@0 | 193 | HttpParams getParams(); |
michael@0 | 194 | |
michael@0 | 195 | /** |
michael@0 | 196 | * Provides parameters to be used for the processing of this message. |
michael@0 | 197 | * @param params the parameters |
michael@0 | 198 | */ |
michael@0 | 199 | void setParams(HttpParams params); |
michael@0 | 200 | |
michael@0 | 201 | } |