0N/A/*
3909N/A * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.net;
0N/A
0N/Aimport java.io.InputStream;
0N/Aimport java.io.IOException;
0N/Aimport java.security.Permission;
0N/Aimport java.util.Date;
0N/A
0N/A/**
0N/A * A URLConnection with support for HTTP-specific features. See
0N/A * <A HREF="http://www.w3.org/pub/WWW/Protocols/"> the spec </A> for
0N/A * details.
0N/A * <p>
0N/A *
0N/A * Each HttpURLConnection instance is used to make a single request
0N/A * but the underlying network connection to the HTTP server may be
0N/A * transparently shared by other instances. Calling the close() methods
0N/A * on the InputStream or OutputStream of an HttpURLConnection
0N/A * after a request may free network resources associated with this
0N/A * instance but has no effect on any shared persistent connection.
0N/A * Calling the disconnect() method may close the underlying socket
0N/A * if a persistent connection is otherwise idle at that time.
0N/A *
0N/A * <P>The HTTP protocol handler has a few settings that can be accessed through
0N/A * System Properties. This covers
0N/A * <a href="doc-files/net-properties.html#Proxies">Proxy settings</a> as well as
0N/A * <a href="doc-files/net-properties.html#MiscHTTP"> various other settings</a>.
0N/A * </P>
0N/A *
0N/A * @see java.net.HttpURLConnection#disconnect()
0N/A * @since JDK1.1
0N/A */
0N/Aabstract public class HttpURLConnection extends URLConnection {
0N/A /* instance variables */
0N/A
0N/A /**
0N/A * The HTTP method (GET,POST,PUT,etc.).
0N/A */
0N/A protected String method = "GET";
0N/A
0N/A /**
0N/A * The chunk-length when using chunked encoding streaming mode for output.
0N/A * A value of <code>-1</code> means chunked encoding is disabled for output.
0N/A * @since 1.5
0N/A */
0N/A protected int chunkLength = -1;
0N/A
0N/A /**
0N/A * The fixed content-length when using fixed-length streaming mode.
0N/A * A value of <code>-1</code> means fixed-length streaming mode is disabled
0N/A * for output.
705N/A *
705N/A * <P> <B>NOTE:</B> {@link #fixedContentLengthLong} is recommended instead
705N/A * of this field, as it allows larger content lengths to be set.
705N/A *
0N/A * @since 1.5
0N/A */
0N/A protected int fixedContentLength = -1;
0N/A
0N/A /**
705N/A * The fixed content-length when using fixed-length streaming mode.
705N/A * A value of {@code -1} means fixed-length streaming mode is disabled
705N/A * for output.
705N/A *
705N/A * @since 1.7
705N/A */
705N/A protected long fixedContentLengthLong = -1;
705N/A
705N/A /**
0N/A * Returns the key for the <code>n</code><sup>th</sup> header field.
0N/A * Some implementations may treat the <code>0</code><sup>th</sup>
0N/A * header field as special, i.e. as the status line returned by the HTTP
0N/A * server. In this case, {@link #getHeaderField(int) getHeaderField(0)} returns the status
0N/A * line, but <code>getHeaderFieldKey(0)</code> returns null.
0N/A *
0N/A * @param n an index, where n >=0.
0N/A * @return the key for the <code>n</code><sup>th</sup> header field,
0N/A * or <code>null</code> if the key does not exist.
0N/A */
0N/A public String getHeaderFieldKey (int n) {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * This method is used to enable streaming of a HTTP request body
0N/A * without internal buffering, when the content length is known in
0N/A * advance.
0N/A * <p>
0N/A * An exception will be thrown if the application
0N/A * attempts to write more data than the indicated
0N/A * content-length, or if the application closes the OutputStream
0N/A * before writing the indicated amount.
0N/A * <p>
0N/A * When output streaming is enabled, authentication
0N/A * and redirection cannot be handled automatically.
0N/A * A HttpRetryException will be thrown when reading
0N/A * the response if authentication or redirection are required.
0N/A * This exception can be queried for the details of the error.
0N/A * <p>
0N/A * This method must be called before the URLConnection is connected.
705N/A * <p>
705N/A * <B>NOTE:</B> {@link #setFixedLengthStreamingMode(long)} is recommended
705N/A * instead of this method as it allows larger content lengths to be set.
0N/A *
0N/A * @param contentLength The number of bytes which will be written
0N/A * to the OutputStream.
0N/A *
0N/A * @throws IllegalStateException if URLConnection is already connected
0N/A * or if a different streaming mode is already enabled.
0N/A *
0N/A * @throws IllegalArgumentException if a content length less than
0N/A * zero is specified.
0N/A *
0N/A * @see #setChunkedStreamingMode(int)
0N/A * @since 1.5
0N/A */
0N/A public void setFixedLengthStreamingMode (int contentLength) {
0N/A if (connected) {
0N/A throw new IllegalStateException ("Already connected");
0N/A }
0N/A if (chunkLength != -1) {
0N/A throw new IllegalStateException ("Chunked encoding streaming mode set");
0N/A }
0N/A if (contentLength < 0) {
0N/A throw new IllegalArgumentException ("invalid content length");
0N/A }
0N/A fixedContentLength = contentLength;
0N/A }
0N/A
705N/A /**
705N/A * This method is used to enable streaming of a HTTP request body
705N/A * without internal buffering, when the content length is known in
705N/A * advance.
705N/A *
705N/A * <P> An exception will be thrown if the application attempts to write
705N/A * more data than the indicated content-length, or if the application
705N/A * closes the OutputStream before writing the indicated amount.
705N/A *
705N/A * <P> When output streaming is enabled, authentication and redirection
705N/A * cannot be handled automatically. A {@linkplain HttpRetryException} will
705N/A * be thrown when reading the response if authentication or redirection
705N/A * are required. This exception can be queried for the details of the
705N/A * error.
705N/A *
705N/A * <P> This method must be called before the URLConnection is connected.
705N/A *
705N/A * <P> The content length set by invoking this method takes precedence
705N/A * over any value set by {@link #setFixedLengthStreamingMode(int)}.
705N/A *
705N/A * @param contentLength
705N/A * The number of bytes which will be written to the OutputStream.
705N/A *
705N/A * @throws IllegalStateException
705N/A * if URLConnection is already connected or if a different
705N/A * streaming mode is already enabled.
705N/A *
705N/A * @throws IllegalArgumentException
705N/A * if a content length less than zero is specified.
705N/A *
705N/A * @since 1.7
705N/A */
705N/A public void setFixedLengthStreamingMode(long contentLength) {
705N/A if (connected) {
705N/A throw new IllegalStateException("Already connected");
705N/A }
705N/A if (chunkLength != -1) {
705N/A throw new IllegalStateException(
705N/A "Chunked encoding streaming mode set");
705N/A }
705N/A if (contentLength < 0) {
705N/A throw new IllegalArgumentException("invalid content length");
705N/A }
705N/A fixedContentLengthLong = contentLength;
705N/A }
705N/A
0N/A /* Default chunk size (including chunk header) if not specified;
0N/A * we want to keep this in sync with the one defined in
0N/A * sun.net.www.http.ChunkedOutputStream
0N/A */
0N/A private static final int DEFAULT_CHUNK_SIZE = 4096;
0N/A
0N/A /**
0N/A * This method is used to enable streaming of a HTTP request body
0N/A * without internal buffering, when the content length is <b>not</b>
0N/A * known in advance. In this mode, chunked transfer encoding
0N/A * is used to send the request body. Note, not all HTTP servers
0N/A * support this mode.
0N/A * <p>
0N/A * When output streaming is enabled, authentication
0N/A * and redirection cannot be handled automatically.
0N/A * A HttpRetryException will be thrown when reading
0N/A * the response if authentication or redirection are required.
0N/A * This exception can be queried for the details of the error.
0N/A * <p>
0N/A * This method must be called before the URLConnection is connected.
0N/A *
0N/A * @param chunklen The number of bytes to write in each chunk.
0N/A * If chunklen is less than or equal to zero, a default
0N/A * value will be used.
0N/A *
0N/A * @throws IllegalStateException if URLConnection is already connected
0N/A * or if a different streaming mode is already enabled.
0N/A *
0N/A * @see #setFixedLengthStreamingMode(int)
0N/A * @since 1.5
0N/A */
0N/A public void setChunkedStreamingMode (int chunklen) {
0N/A if (connected) {
0N/A throw new IllegalStateException ("Can't set streaming mode: already connected");
0N/A }
705N/A if (fixedContentLength != -1 || fixedContentLengthLong != -1) {
0N/A throw new IllegalStateException ("Fixed length streaming mode set");
0N/A }
0N/A chunkLength = chunklen <=0? DEFAULT_CHUNK_SIZE : chunklen;
0N/A }
0N/A
0N/A /**
0N/A * Returns the value for the <code>n</code><sup>th</sup> header field.
0N/A * Some implementations may treat the <code>0</code><sup>th</sup>
0N/A * header field as special, i.e. as the status line returned by the HTTP
0N/A * server.
0N/A * <p>
0N/A * This method can be used in conjunction with the
0N/A * {@link #getHeaderFieldKey getHeaderFieldKey} method to iterate through all
0N/A * the headers in the message.
0N/A *
0N/A * @param n an index, where n>=0.
0N/A * @return the value of the <code>n</code><sup>th</sup> header field,
0N/A * or <code>null</code> if the value does not exist.
0N/A * @see java.net.HttpURLConnection#getHeaderFieldKey(int)
0N/A */
0N/A public String getHeaderField(int n) {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * An <code>int</code> representing the three digit HTTP Status-Code.
0N/A * <ul>
0N/A * <li> 1xx: Informational
0N/A * <li> 2xx: Success
0N/A * <li> 3xx: Redirection
0N/A * <li> 4xx: Client Error
0N/A * <li> 5xx: Server Error
0N/A * </ul>
0N/A */
0N/A protected int responseCode = -1;
0N/A
0N/A /**
0N/A * The HTTP response message.
0N/A */
0N/A protected String responseMessage = null;
0N/A
0N/A /* static variables */
0N/A
0N/A /* do we automatically follow redirects? The default is true. */
0N/A private static boolean followRedirects = true;
0N/A
0N/A /**
0N/A * If <code>true</code>, the protocol will automatically follow redirects.
0N/A * If <code>false</code>, the protocol will not automatically follow
0N/A * redirects.
0N/A * <p>
0N/A * This field is set by the <code>setInstanceFollowRedirects</code>
0N/A * method. Its value is returned by the <code>getInstanceFollowRedirects</code>
0N/A * method.
0N/A * <p>
0N/A * Its default value is based on the value of the static followRedirects
0N/A * at HttpURLConnection construction time.
0N/A *
0N/A * @see java.net.HttpURLConnection#setInstanceFollowRedirects(boolean)
0N/A * @see java.net.HttpURLConnection#getInstanceFollowRedirects()
0N/A * @see java.net.HttpURLConnection#setFollowRedirects(boolean)
0N/A */
0N/A protected boolean instanceFollowRedirects = followRedirects;
0N/A
0N/A /* valid HTTP methods */
0N/A private static final String[] methods = {
0N/A "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"
0N/A };
0N/A
0N/A /**
0N/A * Constructor for the HttpURLConnection.
0N/A * @param u the URL
0N/A */
0N/A protected HttpURLConnection (URL u) {
0N/A super(u);
0N/A }
0N/A
0N/A /**
0N/A * Sets whether HTTP redirects (requests with response code 3xx) should
0N/A * be automatically followed by this class. True by default. Applets
0N/A * cannot change this variable.
0N/A * <p>
0N/A * If there is a security manager, this method first calls
0N/A * the security manager's <code>checkSetFactory</code> method
0N/A * to ensure the operation is allowed.
0N/A * This could result in a SecurityException.
0N/A *
0N/A * @param set a <code>boolean</code> indicating whether or not
0N/A * to follow HTTP redirects.
0N/A * @exception SecurityException if a security manager exists and its
0N/A * <code>checkSetFactory</code> method doesn't
0N/A * allow the operation.
0N/A * @see SecurityManager#checkSetFactory
0N/A * @see #getFollowRedirects()
0N/A */
0N/A public static void setFollowRedirects(boolean set) {
0N/A SecurityManager sec = System.getSecurityManager();
0N/A if (sec != null) {
0N/A // seems to be the best check here...
0N/A sec.checkSetFactory();
0N/A }
0N/A followRedirects = set;
0N/A }
0N/A
0N/A /**
0N/A * Returns a <code>boolean</code> indicating
0N/A * whether or not HTTP redirects (3xx) should
0N/A * be automatically followed.
0N/A *
0N/A * @return <code>true</code> if HTTP redirects should
0N/A * be automatically followed, <tt>false</tt> if not.
0N/A * @see #setFollowRedirects(boolean)
0N/A */
0N/A public static boolean getFollowRedirects() {
0N/A return followRedirects;
0N/A }
0N/A
0N/A /**
0N/A * Sets whether HTTP redirects (requests with response code 3xx) should
0N/A * be automatically followed by this <code>HttpURLConnection</code>
0N/A * instance.
0N/A * <p>
0N/A * The default value comes from followRedirects, which defaults to
0N/A * true.
0N/A *
0N/A * @param followRedirects a <code>boolean</code> indicating
0N/A * whether or not to follow HTTP redirects.
0N/A *
0N/A * @see java.net.HttpURLConnection#instanceFollowRedirects
0N/A * @see #getInstanceFollowRedirects
0N/A * @since 1.3
0N/A */
0N/A public void setInstanceFollowRedirects(boolean followRedirects) {
0N/A instanceFollowRedirects = followRedirects;
0N/A }
0N/A
0N/A /**
0N/A * Returns the value of this <code>HttpURLConnection</code>'s
0N/A * <code>instanceFollowRedirects</code> field.
0N/A *
0N/A * @return the value of this <code>HttpURLConnection</code>'s
0N/A * <code>instanceFollowRedirects</code> field.
0N/A * @see java.net.HttpURLConnection#instanceFollowRedirects
0N/A * @see #setInstanceFollowRedirects(boolean)
0N/A * @since 1.3
0N/A */
0N/A public boolean getInstanceFollowRedirects() {
0N/A return instanceFollowRedirects;
0N/A }
0N/A
0N/A /**
0N/A * Set the method for the URL request, one of:
0N/A * <UL>
0N/A * <LI>GET
0N/A * <LI>POST
0N/A * <LI>HEAD
0N/A * <LI>OPTIONS
0N/A * <LI>PUT
0N/A * <LI>DELETE
0N/A * <LI>TRACE
0N/A * </UL> are legal, subject to protocol restrictions. The default
0N/A * method is GET.
0N/A *
0N/A * @param method the HTTP method
0N/A * @exception ProtocolException if the method cannot be reset or if
0N/A * the requested method isn't valid for HTTP.
2909N/A * @exception SecurityException if a security manager is set and the
3669N/A * method is "TRACE", but the "allowHttpTrace"
3669N/A * NetPermission is not granted.
0N/A * @see #getRequestMethod()
0N/A */
0N/A public void setRequestMethod(String method) throws ProtocolException {
0N/A if (connected) {
0N/A throw new ProtocolException("Can't reset method: already connected");
0N/A }
0N/A // This restriction will prevent people from using this class to
0N/A // experiment w/ new HTTP methods using java. But it should
0N/A // be placed for security - the request String could be
0N/A // arbitrarily long.
0N/A
0N/A for (int i = 0; i < methods.length; i++) {
0N/A if (methods[i].equals(method)) {
2909N/A if (method.equals("TRACE")) {
2909N/A SecurityManager s = System.getSecurityManager();
2909N/A if (s != null) {
2909N/A s.checkPermission(new NetPermission("allowHttpTrace"));
2909N/A }
2909N/A }
0N/A this.method = method;
0N/A return;
0N/A }
0N/A }
0N/A throw new ProtocolException("Invalid HTTP method: " + method);
0N/A }
0N/A
0N/A /**
0N/A * Get the request method.
0N/A * @return the HTTP request method
0N/A * @see #setRequestMethod(java.lang.String)
0N/A */
0N/A public String getRequestMethod() {
0N/A return method;
0N/A }
0N/A
0N/A /**
0N/A * Gets the status code from an HTTP response message.
0N/A * For example, in the case of the following status lines:
0N/A * <PRE>
0N/A * HTTP/1.0 200 OK
0N/A * HTTP/1.0 401 Unauthorized
0N/A * </PRE>
0N/A * It will return 200 and 401 respectively.
0N/A * Returns -1 if no code can be discerned
0N/A * from the response (i.e., the response is not valid HTTP).
0N/A * @throws IOException if an error occurred connecting to the server.
0N/A * @return the HTTP Status-Code, or -1
0N/A */
0N/A public int getResponseCode() throws IOException {
0N/A /*
0N/A * We're got the response code already
0N/A */
0N/A if (responseCode != -1) {
0N/A return responseCode;
0N/A }
0N/A
0N/A /*
0N/A * Ensure that we have connected to the server. Record
0N/A * exception as we need to re-throw it if there isn't
0N/A * a status line.
0N/A */
0N/A Exception exc = null;
0N/A try {
0N/A getInputStream();
0N/A } catch (Exception e) {
0N/A exc = e;
0N/A }
0N/A
0N/A /*
0N/A * If we can't a status-line then re-throw any exception
0N/A * that getInputStream threw.
0N/A */
0N/A String statusLine = getHeaderField(0);
0N/A if (statusLine == null) {
0N/A if (exc != null) {
0N/A if (exc instanceof RuntimeException)
0N/A throw (RuntimeException)exc;
0N/A else
0N/A throw (IOException)exc;
0N/A }
0N/A return -1;
0N/A }
0N/A
0N/A /*
0N/A * Examine the status-line - should be formatted as per
0N/A * section 6.1 of RFC 2616 :-
0N/A *
0N/A * Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase
0N/A *
0N/A * If status line can't be parsed return -1.
0N/A */
0N/A if (statusLine.startsWith("HTTP/1.")) {
0N/A int codePos = statusLine.indexOf(' ');
0N/A if (codePos > 0) {
0N/A
0N/A int phrasePos = statusLine.indexOf(' ', codePos+1);
0N/A if (phrasePos > 0 && phrasePos < statusLine.length()) {
0N/A responseMessage = statusLine.substring(phrasePos+1);
0N/A }
0N/A
0N/A // deviation from RFC 2616 - don't reject status line
0N/A // if SP Reason-Phrase is not included.
0N/A if (phrasePos < 0)
0N/A phrasePos = statusLine.length();
0N/A
0N/A try {
0N/A responseCode = Integer.parseInt
0N/A (statusLine.substring(codePos+1, phrasePos));
0N/A return responseCode;
0N/A } catch (NumberFormatException e) { }
0N/A }
0N/A }
0N/A return -1;
0N/A }
0N/A
0N/A /**
0N/A * Gets the HTTP response message, if any, returned along with the
0N/A * response code from a server. From responses like:
0N/A * <PRE>
0N/A * HTTP/1.0 200 OK
0N/A * HTTP/1.0 404 Not Found
0N/A * </PRE>
0N/A * Extracts the Strings "OK" and "Not Found" respectively.
0N/A * Returns null if none could be discerned from the responses
0N/A * (the result was not valid HTTP).
0N/A * @throws IOException if an error occurred connecting to the server.
0N/A * @return the HTTP response message, or <code>null</code>
0N/A */
0N/A public String getResponseMessage() throws IOException {
0N/A getResponseCode();
0N/A return responseMessage;
0N/A }
0N/A
0N/A public long getHeaderFieldDate(String name, long Default) {
0N/A String dateString = getHeaderField(name);
0N/A try {
0N/A if (dateString.indexOf("GMT") == -1) {
0N/A dateString = dateString+" GMT";
0N/A }
0N/A return Date.parse(dateString);
0N/A } catch (Exception e) {
0N/A }
0N/A return Default;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Indicates that other requests to the server
0N/A * are unlikely in the near future. Calling disconnect()
0N/A * should not imply that this HttpURLConnection
0N/A * instance can be reused for other requests.
0N/A */
0N/A public abstract void disconnect();
0N/A
0N/A /**
0N/A * Indicates if the connection is going through a proxy.
0N/A * @return a boolean indicating if the connection is
0N/A * using a proxy.
0N/A */
0N/A public abstract boolean usingProxy();
0N/A
0N/A /**
0N/A * Returns a {@link SocketPermission} object representing the
0N/A * permission necessary to connect to the destination host and port.
0N/A *
0N/A * @exception IOException if an error occurs while computing
0N/A * the permission.
0N/A *
0N/A * @return a <code>SocketPermission</code> object representing the
0N/A * permission necessary to connect to the destination
0N/A * host and port.
0N/A */
0N/A public Permission getPermission() throws IOException {
0N/A int port = url.getPort();
0N/A port = port < 0 ? 80 : port;
0N/A String host = url.getHost() + ":" + port;
0N/A Permission permission = new SocketPermission(host, "connect");
0N/A return permission;
0N/A }
0N/A
0N/A /**
0N/A * Returns the error stream if the connection failed
0N/A * but the server sent useful data nonetheless. The
0N/A * typical example is when an HTTP server responds
0N/A * with a 404, which will cause a FileNotFoundException
0N/A * to be thrown in connect, but the server sent an HTML
0N/A * help page with suggestions as to what to do.
0N/A *
0N/A * <p>This method will not cause a connection to be initiated. If
0N/A * the connection was not connected, or if the server did not have
0N/A * an error while connecting or if the server had an error but
0N/A * no error data was sent, this method will return null. This is
0N/A * the default.
0N/A *
0N/A * @return an error stream if any, null if there have been no
0N/A * errors, the connection is not connected or the server sent no
0N/A * useful data.
0N/A */
0N/A public InputStream getErrorStream() {
0N/A return null;
0N/A }
0N/A
0N/A /**
0N/A * The response codes for HTTP, as of version 1.1.
0N/A */
0N/A
0N/A // REMIND: do we want all these??
0N/A // Others not here that we do want??
0N/A
0N/A /* 2XX: generally "OK" */
0N/A
0N/A /**
0N/A * HTTP Status-Code 200: OK.
0N/A */
0N/A public static final int HTTP_OK = 200;
0N/A
0N/A /**
0N/A * HTTP Status-Code 201: Created.
0N/A */
0N/A public static final int HTTP_CREATED = 201;
0N/A
0N/A /**
0N/A * HTTP Status-Code 202: Accepted.
0N/A */
0N/A public static final int HTTP_ACCEPTED = 202;
0N/A
0N/A /**
0N/A * HTTP Status-Code 203: Non-Authoritative Information.
0N/A */
0N/A public static final int HTTP_NOT_AUTHORITATIVE = 203;
0N/A
0N/A /**
0N/A * HTTP Status-Code 204: No Content.
0N/A */
0N/A public static final int HTTP_NO_CONTENT = 204;
0N/A
0N/A /**
0N/A * HTTP Status-Code 205: Reset Content.
0N/A */
0N/A public static final int HTTP_RESET = 205;
0N/A
0N/A /**
0N/A * HTTP Status-Code 206: Partial Content.
0N/A */
0N/A public static final int HTTP_PARTIAL = 206;
0N/A
0N/A /* 3XX: relocation/redirect */
0N/A
0N/A /**
0N/A * HTTP Status-Code 300: Multiple Choices.
0N/A */
0N/A public static final int HTTP_MULT_CHOICE = 300;
0N/A
0N/A /**
0N/A * HTTP Status-Code 301: Moved Permanently.
0N/A */
0N/A public static final int HTTP_MOVED_PERM = 301;
0N/A
0N/A /**
0N/A * HTTP Status-Code 302: Temporary Redirect.
0N/A */
0N/A public static final int HTTP_MOVED_TEMP = 302;
0N/A
0N/A /**
0N/A * HTTP Status-Code 303: See Other.
0N/A */
0N/A public static final int HTTP_SEE_OTHER = 303;
0N/A
0N/A /**
0N/A * HTTP Status-Code 304: Not Modified.
0N/A */
0N/A public static final int HTTP_NOT_MODIFIED = 304;
0N/A
0N/A /**
0N/A * HTTP Status-Code 305: Use Proxy.
0N/A */
0N/A public static final int HTTP_USE_PROXY = 305;
0N/A
0N/A /* 4XX: client error */
0N/A
0N/A /**
0N/A * HTTP Status-Code 400: Bad Request.
0N/A */
0N/A public static final int HTTP_BAD_REQUEST = 400;
0N/A
0N/A /**
0N/A * HTTP Status-Code 401: Unauthorized.
0N/A */
0N/A public static final int HTTP_UNAUTHORIZED = 401;
0N/A
0N/A /**
0N/A * HTTP Status-Code 402: Payment Required.
0N/A */
0N/A public static final int HTTP_PAYMENT_REQUIRED = 402;
0N/A
0N/A /**
0N/A * HTTP Status-Code 403: Forbidden.
0N/A */
0N/A public static final int HTTP_FORBIDDEN = 403;
0N/A
0N/A /**
0N/A * HTTP Status-Code 404: Not Found.
0N/A */
0N/A public static final int HTTP_NOT_FOUND = 404;
0N/A
0N/A /**
0N/A * HTTP Status-Code 405: Method Not Allowed.
0N/A */
0N/A public static final int HTTP_BAD_METHOD = 405;
0N/A
0N/A /**
0N/A * HTTP Status-Code 406: Not Acceptable.
0N/A */
0N/A public static final int HTTP_NOT_ACCEPTABLE = 406;
0N/A
0N/A /**
0N/A * HTTP Status-Code 407: Proxy Authentication Required.
0N/A */
0N/A public static final int HTTP_PROXY_AUTH = 407;
0N/A
0N/A /**
0N/A * HTTP Status-Code 408: Request Time-Out.
0N/A */
0N/A public static final int HTTP_CLIENT_TIMEOUT = 408;
0N/A
0N/A /**
0N/A * HTTP Status-Code 409: Conflict.
0N/A */
0N/A public static final int HTTP_CONFLICT = 409;
0N/A
0N/A /**
0N/A * HTTP Status-Code 410: Gone.
0N/A */
0N/A public static final int HTTP_GONE = 410;
0N/A
0N/A /**
0N/A * HTTP Status-Code 411: Length Required.
0N/A */
0N/A public static final int HTTP_LENGTH_REQUIRED = 411;
0N/A
0N/A /**
0N/A * HTTP Status-Code 412: Precondition Failed.
0N/A */
0N/A public static final int HTTP_PRECON_FAILED = 412;
0N/A
0N/A /**
0N/A * HTTP Status-Code 413: Request Entity Too Large.
0N/A */
0N/A public static final int HTTP_ENTITY_TOO_LARGE = 413;
0N/A
0N/A /**
0N/A * HTTP Status-Code 414: Request-URI Too Large.
0N/A */
0N/A public static final int HTTP_REQ_TOO_LONG = 414;
0N/A
0N/A /**
0N/A * HTTP Status-Code 415: Unsupported Media Type.
0N/A */
0N/A public static final int HTTP_UNSUPPORTED_TYPE = 415;
0N/A
0N/A /* 5XX: server error */
0N/A
0N/A /**
0N/A * HTTP Status-Code 500: Internal Server Error.
0N/A * @deprecated it is misplaced and shouldn't have existed.
0N/A */
0N/A @Deprecated
0N/A public static final int HTTP_SERVER_ERROR = 500;
0N/A
0N/A /**
0N/A * HTTP Status-Code 500: Internal Server Error.
0N/A */
0N/A public static final int HTTP_INTERNAL_ERROR = 500;
0N/A
0N/A /**
0N/A * HTTP Status-Code 501: Not Implemented.
0N/A */
0N/A public static final int HTTP_NOT_IMPLEMENTED = 501;
0N/A
0N/A /**
0N/A * HTTP Status-Code 502: Bad Gateway.
0N/A */
0N/A public static final int HTTP_BAD_GATEWAY = 502;
0N/A
0N/A /**
0N/A * HTTP Status-Code 503: Service Unavailable.
0N/A */
0N/A public static final int HTTP_UNAVAILABLE = 503;
0N/A
0N/A /**
0N/A * HTTP Status-Code 504: Gateway Timeout.
0N/A */
0N/A public static final int HTTP_GATEWAY_TIMEOUT = 504;
0N/A
0N/A /**
0N/A * HTTP Status-Code 505: HTTP Version Not Supported.
0N/A */
0N/A public static final int HTTP_VERSION = 505;
0N/A
0N/A}