📄 httpurlconnection.html
字号:
HTTP Status-Code 414: Request-URI Too Large.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_RESET">HTTP_RESET</A></B></CODE><BR> HTTP Status-Code 205: Reset Content.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_SEE_OTHER">HTTP_SEE_OTHER</A></B></CODE><BR> HTTP Status-Code 303: See Other.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_SERVER_ERROR">HTTP_SERVER_ERROR</A></B></CODE><BR> <B>Deprecated.</B> <I>it is misplaced and shouldn't have existed.</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_UNAUTHORIZED">HTTP_UNAUTHORIZED</A></B></CODE><BR> HTTP Status-Code 401: Unauthorized.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_UNAVAILABLE">HTTP_UNAVAILABLE</A></B></CODE><BR> HTTP Status-Code 503: Service Unavailable.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_UNSUPPORTED_TYPE">HTTP_UNSUPPORTED_TYPE</A></B></CODE><BR> HTTP Status-Code 415: Unsupported Media Type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_USE_PROXY">HTTP_USE_PROXY</A></B></CODE><BR> HTTP Status-Code 305: Use Proxy.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HTTP_VERSION">HTTP_VERSION</A></B></CODE><BR> HTTP Status-Code 505: HTTP Version Not Supported.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#instanceFollowRedirects">instanceFollowRedirects</A></B></CODE><BR> If <code>true</code>, the protocol will automatically follow redirects.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#method">method</A></B></CODE><BR> The HTTP method (GET,POST,PUT,etc.).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#responseCode">responseCode</A></B></CODE><BR> An <code>int</code> representing the three digit HTTP Status-Code.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#responseMessage">responseMessage</A></B></CODE><BR> The HTTP response message.</TD></TR></TABLE> <A NAME="fields_inherited_from_class_java.net.URLConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.net.<A HREF="../../java/net/URLConnection.html">URLConnection</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/net/URLConnection.html#allowUserInteraction">allowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#connected">connected</A>, <A HREF="../../java/net/URLConnection.html#doInput">doInput</A>, <A HREF="../../java/net/URLConnection.html#doOutput">doOutput</A>, <A HREF="../../java/net/URLConnection.html#ifModifiedSince">ifModifiedSince</A>, <A HREF="../../java/net/URLConnection.html#url">url</A>, <A HREF="../../java/net/URLConnection.html#useCaches">useCaches</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#HttpURLConnection(java.net.URL)">HttpURLConnection</A></B>(<A HREF="../../java/net/URL.html">URL</A> u)</CODE><BR> Constructor for the URLStreamHandler.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#disconnect()">disconnect</A></B>()</CODE><BR> Indicates that other requests to the server are unlikely in the near future.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/io/InputStream.html">InputStream</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getErrorStream()">getErrorStream</A></B>()</CODE><BR> Returns the error stream if the connection failed but the server sent useful data nonetheless.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getFollowRedirects()">getFollowRedirects</A></B>()</CODE><BR> Returns a <code>boolean</code> indicating whether or not HTTP redirects (3xx) should be automatically followed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getHeaderFieldDate(java.lang.String, long)">getHeaderFieldDate</A></B>(<A HREF="../../java/lang/String.html">String</A> name, long Default)</CODE><BR> Returns the value of the named field parsed as date.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getInstanceFollowRedirects()">getInstanceFollowRedirects</A></B>()</CODE><BR> Returns the value of this <code>HttpURLConnection</code>'s <code>instanceFollowRedirects</code> field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/security/Permission.html">Permission</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getPermission()">getPermission</A></B>()</CODE><BR> Returns a permission object representing the permission necessary to make the connection represented by this object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getRequestMethod()">getRequestMethod</A></B>()</CODE><BR> Get the request method.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getResponseCode()">getResponseCode</A></B>()</CODE><BR> Gets HTTP response status from responses like: </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#getResponseMessage()">getResponseMessage</A></B>()</CODE><BR> Gets the HTTP response message, if any, returned along with the response code from a server.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#setFollowRedirects(boolean)">setFollowRedirects</A></B>(boolean set)</CODE><BR> Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#setInstanceFollowRedirects(boolean)">setInstanceFollowRedirects</A></B>(boolean followRedirects)</CODE><BR> Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this <code>HttpURLConnection</code> instance.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#setRequestMethod(java.lang.String)">setRequestMethod</A></B>(<A HREF="../../java/lang/String.html">String</A> method)</CODE><BR> Set the method for the URL request, one of: GET POST HEAD OPTIONS PUT DELETE TRACE are legal, subject to protocol restrictions.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/HttpURLConnection.html#usingProxy()">usingProxy</A></B>()</CODE><BR> Indicates if the connection is going through a proxy.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.net.URLConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.net.<A HREF="../../java/net/URLConnection.html">URLConnection</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/net/URLConnection.html#connect()">connect</A>, <A HREF="../../java/net/URLConnection.html#getAllowUserInteraction()">getAllowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#getContent()">getContent</A>, <A HREF="../../java/net/URLConnection.html#getContent(java.lang.Class[])">getContent</A>, <A HREF="../../java/net/URLConnection.html#getContentEncoding()">getContentEncoding</A>, <A HREF="../../java/net/URLConnection.html#getContentLength()">getContentLength</A>, <A HREF="../../java/net/URLConnection.html#getContentType()">getContentType</A>, <A HREF="../../java/net/URLConnection.html#getDate()">getDate</A>, <A HREF="../../java/net/URLConnection.html#getDefaultAllowUserInteraction()">getDefaultAllowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#getDefaultRequestProperty(java.lang.String)">getDefaultRequestProperty</A>, <A HREF="../../java/net/URLConnection.html#getDefaultUseCaches()">getDefaultUseCaches</A>, <A HREF="../../java/net/URLConnection.html#getDoInput()">getDoInput</A>, <A HREF="../../java/net/URLConnection.html#getDoOutput()">getDoOutput</A>, <A HREF="../../java/net/URLConnection.html#getExpiration()">getExpiration</A>, <A HREF="../../java/net/URLConnection.html#getFileNameMap()">getFileNameMap</A>, <A HREF="../../java/net/URLConnection.html#getHeaderField(int)">getHeaderField</A>, <A HREF="../../java/net/URLConnection.html#getHeaderField(java.lang.String)">getHeaderField</A>, <A HREF="../../java/net/URLConnection.html#getHeaderFieldInt(java.lang.String, int)">getHeaderFieldInt</A>, <A HREF="../../java/net/URLConnection.html#getHeaderFieldKey(int)">getHeaderFieldKey</A>, <A HREF="../../java/net/URLConnection.html#getIfModifiedSince()">getIfModifiedSince</A>, <A HREF="../../java/net/URLConnection.html#getInputStream()">getInputStream</A>, <A HREF="../../java/net/URLConnection.html#getLastModified()">getLastModified</A>, <A HREF="../../java/net/URLConnection.html#getOutputStream()">getOutputStream</A>, <A HREF="../../java/net/URLConnection.html#getRequestProperty(java.lang.String)">getRequestProperty</A>, <A HREF="../../java/net/URLConnection.html#getURL()">getURL</A>, <A HREF="../../java/net/URLConnection.html#getUseCaches()">getUseCaches</A>, <A HREF="../../java/net/URLConnection.html#guessContentTypeFromName(java.lang.String)">guessContentTypeFromName</A>, <A HREF="../../java/net/URLConnection.html#guessContentTypeFromStream(java.io.InputStream)">guessContentTypeFromStream</A>, <A HREF="../../java/net/URLConnection.html#setAllowUserInteraction(boolean)">setAllowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#setContentHandlerFactory(java.net.ContentHandlerFactory)">setContentHandlerFactory</A>, <A HREF="../../java/net/URLConnection.html#setDefaultAllowUserInteraction(boolean)">setDefaultAllowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#setDefaultRequestProperty(java.lang.String, java.lang.String)">setDefaultRequestProperty</A>, <A HREF="../../java/net/URLConnection.html#setDefaultUseCaches(boolean)">setDefaultUseCaches</A>, <A HREF="../../java/net/URLConnection.html#setDoInput(boolean)">setDoInput</A>, <A HREF="../../java/net/URLConnection.html#setDoOutput(boolean)">setDoOutput</A>, <A HREF="../../java/net/URLConnection.html#setFileNameMap(java.net.FileNameMap)">setFileNameMap</A>, <A HREF="../../java/net/URLConnection.html#setIfModifiedSince(long)">setIfModifiedSince</A>, <A HREF="../../java/net/URLConnection.html#setRequestProperty(java.lang.String, java.lang.String)">setRequestProperty</A>, <A HREF="../../java/net/URLConnection.html#setUseCaches(boolean)">setUseCaches</A>, <A HREF="../../java/net/URLConnection.html#toString()">toString</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="method"><!-- --></A><H3>method</H3><PRE>protected <A HREF="../../java/lang/String.html">String</A> <B>method</B></PRE><DL><DD>The HTTP method (GET,POST,PUT,etc.).</DL><HR><A NAME="responseCode"><!-- --></A><H3>responseCode</H3><PRE>protected int <B>responseCode</B></PRE><DL><DD>An <code>int</code> representing the three digit HTTP Status-Code. <ul> <li> 1xx: Informational <li> 2xx: Success <li> 3xx: Redirection <li> 4xx: Client Error <li> 5xx: Server Error </ul></DL><HR><A NAME="responseMessage"><!-- --></A><H3>responseMessage</H3><PRE>protected <A HREF="../../java/lang/String.html">String</A> <B>responseMessage</B></PRE><DL><DD>The HTTP response message.</DL><HR><A NAME="instanceFollowRedirects"><!-- --></A><H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -