📄 httpconnection.html
字号:
public static final int <B>HTTP_EXPECT_FAILED</B></PRE><DL><DD>417: The expectation given in an Expect request-header field could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server.</DL><HR><A NAME="HTTP_INTERNAL_ERROR"><!-- --></A><H3>HTTP_INTERNAL_ERROR</H3><PRE>public static final int <B>HTTP_INTERNAL_ERROR</B></PRE><DL><DD>500: The server encountered an unexpected condition which prevented it from fulfilling the request.</DL><HR><A NAME="HTTP_NOT_IMPLEMENTED"><!-- --></A><H3>HTTP_NOT_IMPLEMENTED</H3><PRE>public static final int <B>HTTP_NOT_IMPLEMENTED</B></PRE><DL><DD>501: The server does not support the functionality required to fulfill the request.</DL><HR><A NAME="HTTP_BAD_GATEWAY"><!-- --></A><H3>HTTP_BAD_GATEWAY</H3><PRE>public static final int <B>HTTP_BAD_GATEWAY</B></PRE><DL><DD>502: The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.</DL><HR><A NAME="HTTP_UNAVAILABLE"><!-- --></A><H3>HTTP_UNAVAILABLE</H3><PRE>public static final int <B>HTTP_UNAVAILABLE</B></PRE><DL><DD>503: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.</DL><HR><A NAME="HTTP_GATEWAY_TIMEOUT"><!-- --></A><H3>HTTP_GATEWAY_TIMEOUT</H3><PRE>public static final int <B>HTTP_GATEWAY_TIMEOUT</B></PRE><DL><DD>504: The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access in attempting to complete the request.</DL><HR><A NAME="HTTP_VERSION"><!-- --></A><H3>HTTP_VERSION</H3><PRE>public static final int <B>HTTP_VERSION</B></PRE><DL><DD>505: The server does not support, or refuses to support, the HTTP protocol version that was used in the request message.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getURL()"><!-- --></A><H3>getURL</H3><PRE>public String <B>getURL</B>()</PRE><DL><DD>Return a string representation of the URL for this connection.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the string representation of the URL for this connection.</DL></DD></DL><HR><A NAME="getProtocol()"><!-- --></A><H3>getProtocol</H3><PRE>public String <B>getProtocol</B>()</PRE><DL><DD>Returns the protocol name of the URL of this <code>HttpConnection</code>. e.g., http or https<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the protocol of the URL of this <code>HttpConnection</code>.</DL></DD></DL><HR><A NAME="getHost()"><!-- --></A><H3>getHost</H3><PRE>public String <B>getHost</B>()</PRE><DL><DD>Returns the host information of the URL of this <code>HttpConnection</code>. e.g. host name or IPv4 address<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the host information of the URL of this <code>HttpConnection</code>.</DL></DD></DL><HR><A NAME="getFile()"><!-- --></A><H3>getFile</H3><PRE>public String <B>getFile</B>()</PRE><DL><DD>Returns the file portion of the URL of this <code>HttpConnection</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the file portion of the URL of this <code>HttpConnection</code>. <code>null</code> is returned if there is no file.</DL></DD></DL><HR><A NAME="getRef()"><!-- --></A><H3>getRef</H3><PRE>public String <B>getRef</B>()</PRE><DL><DD>Returns the ref portion of the URL of this <code>HttpConnection</code>. RFC2396 specifies the optional fragment identifier as the the text after the crosshatch (#) character in the URL. This information may be used by the user agent as additional reference information after the resource is successfully retrieved. The format and interpretation of the fragment identifier is dependent on the media type[RFC2046] of the retrieved information.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the ref portion of the URL of this <code>HttpConnection</code>. <code>null</code> is returned if there is no value.</DL></DD></DL><HR><A NAME="getQuery()"><!-- --></A><H3>getQuery</H3><PRE>public String <B>getQuery</B>()</PRE><DL><DD>Returns the query portion of the URL of this <code>HttpConnection</code>. RFC2396 defines the query component as the text after the first question-mark (?) character in the URL.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the query portion of the URL of this <code>HttpConnection</code>. <code>null</code> is returned if there is no value.</DL></DD></DL><HR><A NAME="getPort()"><!-- --></A><H3>getPort</H3><PRE>public int <B>getPort</B>()</PRE><DL><DD>Returns the network port number of the URL for this <code>HttpConnection</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the network port number of the URL for this <code>HttpConnection</code>. The default HTTP port number (80) is returned if there was no port number in the string passed to <code>Connector.open</code>.</DL></DD></DL><HR><A NAME="getRequestMethod()"><!-- --></A><H3>getRequestMethod</H3><PRE>public String <B>getRequestMethod</B>()</PRE><DL><DD>Get the current request method. e.g. HEAD, GET, POST The default value is GET.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the HTTP request method<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/io/HttpConnection.html#setRequestMethod(java.lang.String)"><CODE>setRequestMethod(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setRequestMethod(java.lang.String)"><!-- --></A><H3>setRequestMethod</H3><PRE>public void <B>setRequestMethod</B>(String method) throws java.io.IOException</PRE><DL><DD>Set the method for the URL request, one of: <UL> <LI>GET <LI>POST <LI>HEAD </UL> are legal, subject to protocol restrictions. The default method is GET.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>method</CODE> - the HTTP method<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if the method cannot be reset or if the requested method isn't valid for HTTP.<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/io/HttpConnection.html#getRequestMethod()"><CODE>getRequestMethod()</CODE></A></DL></DD></DL><HR><A NAME="getRequestProperty(java.lang.String)"><!-- --></A><H3>getRequestProperty</H3><PRE>public String <B>getRequestProperty</B>(String key)</PRE><DL><DD>Returns the value of the named general request property for this connection.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the keyword by which the request property is known (e.g., "accept").<DT><B>Returns:</B><DD>the value of the named general request property for this connection. If there is no key with the specified name then <CODE>null</CODE> is returned.<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/io/HttpConnection.html#setRequestProperty(java.lang.String, java.lang.String)"><CODE>setRequestProperty(java.lang.String, java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setRequestProperty(java.lang.String, java.lang.String)"><!-- --></A><H3>setRequestProperty</H3><PRE>public void <B>setRequestProperty</B>(String key, String value) throws java.io.IOException</PRE><DL><DD>Sets the general request property. If a property with the key already exists, overwrite its value with the new value. <p> <strong>Note:</strong> HTTP requires all request properties which can legally have multiple instances with the same key to use a comma-separated list syntax which enables multiple properties to be appended into a single property.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>key</CODE> - the keyword by which the request is known (e.g., "<code>accept</code>").<DD><CODE>value</CODE> - the value associated with it.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - is thrown if the connection is in the connected state.<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/io/HttpConnection.html#getRequestProperty(java.lang.String)"><CODE>getRequestProperty(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getResponseCode()"><!-- --></A><H3>getResponseCode</H3><PRE>public int <B>getResponseCode</B>() throws java.io.IOException</PRE><DL><DD>Returns the HTTP response status code. It parses responses like: <PRE> HTTP/1.0 200 OK HTTP/1.0 401 Unauthorized </PRE> and extracts the ints 200 and 401 respectively. from the response (i.e., the response is not valid HTTP).<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the HTTP Status-Code or -1 if no status code can be discerned.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an error occurred connecting to the server.</DL></DD></DL><HR><A NAME="getResponseMessage()"><!-- --></A><H3>getResponseMessage</H3><PRE>public String <B>getResponseMessage</B>() throws java.io.IOException</PRE><DL><DD>Gets the HTTP response message, if any, returned along with the response code from a server. From responses like: <PRE> HTTP/1.0 200 OK HTTP/1.0 404 Not Found </PRE> Extracts the Strings "OK" and "Not Found" respectively. Returns null if none could be discerned from the responses (the result was not valid HTTP).<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the HTTP response message, or <code>null</code><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an error occurred connecting to the server.</DL></DD></DL><HR><A NAME="getExpiration()"><!-- --></A><H3>getExpiration</H3><PRE>public long <B>getExpiration</B>() throws java.io.IOException</PRE><DL><DD>Returns the value of the <code>expires</code> header field.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the expiration date of the resource that this URL references, or 0 if not known. The value is the number of milliseconds since January 1, 1970 GMT.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an error occurred connecting to the server.</DL></DD></DL><HR><A NAME="getDate()"><!-- --></A><H3>getDate</H3><PRE>public long <B>getDate</B>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -