mobile/android/thirdparty/ch/boye/httpclientandroidlib/HttpResponse.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

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 java.util.Locale;
michael@0 31
michael@0 32 /**
michael@0 33 * After receiving and interpreting a request message, a server responds
michael@0 34 * with an HTTP response message.
michael@0 35 * <pre>
michael@0 36 * Response = Status-Line
michael@0 37 * *(( general-header
michael@0 38 * | response-header
michael@0 39 * | entity-header ) CRLF)
michael@0 40 * CRLF
michael@0 41 * [ message-body ]
michael@0 42 * </pre>
michael@0 43 *
michael@0 44 * @since 4.0
michael@0 45 */
michael@0 46 public interface HttpResponse extends HttpMessage {
michael@0 47
michael@0 48 /**
michael@0 49 * Obtains the status line of this response.
michael@0 50 * The status line can be set using one of the
michael@0 51 * {@link #setStatusLine setStatusLine} methods,
michael@0 52 * or it can be initialized in a constructor.
michael@0 53 *
michael@0 54 * @return the status line, or <code>null</code> if not yet set
michael@0 55 */
michael@0 56 StatusLine getStatusLine();
michael@0 57
michael@0 58 /**
michael@0 59 * Sets the status line of this response.
michael@0 60 *
michael@0 61 * @param statusline the status line of this response
michael@0 62 */
michael@0 63 void setStatusLine(StatusLine statusline);
michael@0 64
michael@0 65 /**
michael@0 66 * Sets the status line of this response.
michael@0 67 * The reason phrase will be determined based on the current
michael@0 68 * {@link #getLocale locale}.
michael@0 69 *
michael@0 70 * @param ver the HTTP version
michael@0 71 * @param code the status code
michael@0 72 */
michael@0 73 void setStatusLine(ProtocolVersion ver, int code);
michael@0 74
michael@0 75 /**
michael@0 76 * Sets the status line of this response with a reason phrase.
michael@0 77 *
michael@0 78 * @param ver the HTTP version
michael@0 79 * @param code the status code
michael@0 80 * @param reason the reason phrase, or <code>null</code> to omit
michael@0 81 */
michael@0 82 void setStatusLine(ProtocolVersion ver, int code, String reason);
michael@0 83
michael@0 84 /**
michael@0 85 * Updates the status line of this response with a new status code.
michael@0 86 * The status line can only be updated if it is available. It must
michael@0 87 * have been set either explicitly or in a constructor.
michael@0 88 * <br/>
michael@0 89 * The reason phrase will be updated according to the new status code,
michael@0 90 * based on the current {@link #getLocale locale}. It can be set
michael@0 91 * explicitly using {@link #setReasonPhrase setReasonPhrase}.
michael@0 92 *
michael@0 93 * @param code the HTTP status code.
michael@0 94 *
michael@0 95 * @throws IllegalStateException
michael@0 96 * if the status line has not be set
michael@0 97 *
michael@0 98 * @see HttpStatus
michael@0 99 * @see #setStatusLine(StatusLine)
michael@0 100 * @see #setStatusLine(ProtocolVersion,int)
michael@0 101 */
michael@0 102 void setStatusCode(int code)
michael@0 103 throws IllegalStateException;
michael@0 104
michael@0 105 /**
michael@0 106 * Updates the status line of this response with a new reason phrase.
michael@0 107 * The status line can only be updated if it is available. It must
michael@0 108 * have been set either explicitly or in a constructor.
michael@0 109 *
michael@0 110 * @param reason the new reason phrase as a single-line string, or
michael@0 111 * <code>null</code> to unset the reason phrase
michael@0 112 *
michael@0 113 * @throws IllegalStateException
michael@0 114 * if the status line has not be set
michael@0 115 *
michael@0 116 * @see #setStatusLine(StatusLine)
michael@0 117 * @see #setStatusLine(ProtocolVersion,int)
michael@0 118 */
michael@0 119 void setReasonPhrase(String reason)
michael@0 120 throws IllegalStateException;
michael@0 121
michael@0 122 /**
michael@0 123 * Obtains the message entity of this response, if any.
michael@0 124 * The entity is provided by calling {@link #setEntity setEntity}.
michael@0 125 *
michael@0 126 * @return the response entity, or
michael@0 127 * <code>null</code> if there is none
michael@0 128 */
michael@0 129 HttpEntity getEntity();
michael@0 130
michael@0 131 /**
michael@0 132 * Associates a response entity with this response.
michael@0 133 *
michael@0 134 * @param entity the entity to associate with this response, or
michael@0 135 * <code>null</code> to unset
michael@0 136 */
michael@0 137 void setEntity(HttpEntity entity);
michael@0 138
michael@0 139 /**
michael@0 140 * Obtains the locale of this response.
michael@0 141 * The locale is used to determine the reason phrase
michael@0 142 * for the {@link #setStatusCode status code}.
michael@0 143 * It can be changed using {@link #setLocale setLocale}.
michael@0 144 *
michael@0 145 * @return the locale of this response, never <code>null</code>
michael@0 146 */
michael@0 147 Locale getLocale();
michael@0 148
michael@0 149 /**
michael@0 150 * Changes the locale of this response.
michael@0 151 * If there is a status line, it's reason phrase will be updated
michael@0 152 * according to the status code and new locale.
michael@0 153 *
michael@0 154 * @param loc the new locale
michael@0 155 *
michael@0 156 * @see #getLocale getLocale
michael@0 157 * @see #setStatusCode setStatusCode
michael@0 158 */
michael@0 159 void setLocale(Locale loc);
michael@0 160 }

mercurial