Edit D:\app\Administrator\product\11.2.0\dbhome_1\owb\lib\int\HTTPClient\doc\api\HTTPClient\HttpURLConnection.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Mon May 07 18:52:25 PDT 2001 --> <TITLE> HTTPClient API: Class HttpURLConnection </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../HTTPClient/HTTPResponse.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/Log.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="HttpURLConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> HTTPClient</FONT> <BR> Class HttpURLConnection</H2> <PRE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">java.lang.Object</A> | +--<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">java.net.URLConnection</A> | +--<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">java.net.HttpURLConnection</A> | +--<B>HTTPClient.HttpURLConnection</B> </PRE> <HR> <DL> <DT>public class <B>HttpURLConnection</B><DT>extends <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> <P> This class is a wrapper around HTTPConnection providing the interface defined by java.net.URLConnection and java.net.HttpURLConnection. <P>This class can be used to replace the HttpClient in the JDK with this HTTPClient by defining the property <code>java.protocol.handler.pkgs=HTTPClient</code>. <P>One difference between Sun's HttpClient and this one is that this one will provide you with a real output stream if possible. This leads to two changes: you should set the request property "Content-Length", if possible, before invoking getOutputStream(); and in many cases getOutputStream() implies connect(). This should be transparent, though, apart from the fact that you can't change any headers or other settings anymore once you've gotten the output stream. So, for large data do: <PRE> HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestProperty("Content-Length", ...); OutputStream out = con.getOutputStream(); out.write(...); out.close(); if (con.getResponseCode() != 200) ... </PRE> <P>The HTTPClient will send the request data using the chunked transfer encoding when no Content-Length is specified and the server is HTTP/1.1 compatible. Because cgi-scripts can't usually handle this, you may experience problems trying to POST data. For this reason, whenever the Content-Type is application/x-www-form-urlencoded getOutputStream() will buffer the data before sending it so as prevent chunking. If you are sending requests with a different Content-Type and are experiencing problems then you may want to try setting the system property <var>HTTPClient.dontChunkRequests</var> to <var>true</var> (this needs to be done either on the command line or somewhere in the code before the first URLConnection.openConnection() is invoked). <P>A second potential incompatibility is that the HTTPClient aggresively resuses connections, and can do so more often that Sun's client. This can cause problems if you send multiple requests, and the first one has a long response. In this case (assuming the server allows the connection to be used for multiple requests) the responses to second, third, etc request won't be received until the first response has been completely read. With Sun's client on the other hand you may not experience this, as it may not be able to keep the connection open and there may create multiple connections for the requests. This allows the responses to the second, third, etc requests to be read before the first response has completed. <strong>Note:</strong> whether this will happen depends on details of the resource being requested and the server. In many cases the HTTPClient and Sun's client will exhibit the same behaviour. Also, applications which depend on being able to read the second response before the first one has completed must be considered broken, because A) this behaviour cannot be relied upon even in Sun's current client, and B) Sun's implementation will exhibit the same problem if they ever switch to HTTP/1.1. <P> <DL> <DT><B>Since: </B><DD>V0.3</DD> <DT><B>Version: </B><DD>0.3-3 06/05/2001</DD> <DT><B>Author: </B><DD>Ronald Tschal?</DD> </DL> <HR> <P> <!-- ======== INNER CLASS SUMMARY ======== --> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Field Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected <A HREF="../HTTPClient/HTTPConnection.html">HTTPConnection</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#con">con</A></B></CODE> <BR> the current connection</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/util/Hashtable.html">Hashtable</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#connections">connections</A></B></CODE> <BR> the cache of HTTPConnections</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected <A HREF="../HTTPClient/HTTPResponse.html">HTTPResponse</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#resp">resp</A></B></CODE> <BR> the response</TD> </TR> </TABLE> <A NAME="fields_inherited_from_class_java.net.HttpURLConnection"><!-- --></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="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_ACCEPTED">HTTP_ACCEPTED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_BAD_GATEWAY">HTTP_BAD_GATEWAY</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_BAD_METHOD">HTTP_BAD_METHOD</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_BAD_REQUEST">HTTP_BAD_REQUEST</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_CLIENT_TIMEOUT">HTTP_CLIENT_TIMEOUT</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_CONFLICT">HTTP_CONFLICT</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_CREATED">HTTP_CREATED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_ENTITY_TOO_LARGE">HTTP_ENTITY_TOO_LARGE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_FORBIDDEN">HTTP_FORBIDDEN</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_GATEWAY_TIMEOUT">HTTP_GATEWAY_TIMEOUT</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_GONE">HTTP_GONE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_INTERNAL_ERROR">HTTP_INTERNAL_ERROR</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_LENGTH_REQUIRED">HTTP_LENGTH_REQUIRED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_MOVED_PERM">HTTP_MOVED_PERM</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_MOVED_TEMP">HTTP_MOVED_TEMP</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_MULT_CHOICE">HTTP_MULT_CHOICE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_NO_CONTENT">HTTP_NO_CONTENT</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_NOT_ACCEPTABLE">HTTP_NOT_ACCEPTABLE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_NOT_AUTHORITATIVE">HTTP_NOT_AUTHORITATIVE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_NOT_FOUND">HTTP_NOT_FOUND</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_NOT_MODIFIED">HTTP_NOT_MODIFIED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_OK">HTTP_OK</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_PARTIAL">HTTP_PARTIAL</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_PAYMENT_REQUIRED">HTTP_PAYMENT_REQUIRED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_PRECON_FAILED">HTTP_PRECON_FAILED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_PROXY_AUTH">HTTP_PROXY_AUTH</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_REQ_TOO_LONG">HTTP_REQ_TOO_LONG</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_RESET">HTTP_RESET</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_SEE_OTHER">HTTP_SEE_OTHER</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_SERVER_ERROR">HTTP_SERVER_ERROR</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_UNAUTHORIZED">HTTP_UNAUTHORIZED</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_UNAVAILABLE">HTTP_UNAVAILABLE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_UNSUPPORTED_TYPE">HTTP_UNSUPPORTED_TYPE</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_USE_PROXY">HTTP_USE_PROXY</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#HTTP_VERSION">HTTP_VERSION</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#method">method</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#responseCode">responseCode</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#responseMessage">responseMessage</A></CODE></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="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#allowUserInteraction">allowUserInteraction</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#connected">connected</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#doInput">doInput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#doOutput">doOutput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#ifModifiedSince">ifModifiedSince</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#url">url</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/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><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#HttpURLConnection(java.net.URL)">HttpURLConnection</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A> url)</CODE> <BR> Construct a connection to the specified url.</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> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#connect()">connect</A></B>()</CODE> <BR> Connects to the server (if connection not still kept alive) and issues the request.</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="../HTTPClient/HttpURLConnection.html#disconnect()">disconnect</A></B>()</CODE> <BR> Closes all the connections to this server.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected <A HREF="../HTTPClient/HTTPConnection.html">HTTPConnection</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getConnection(java.net.URL)">getConnection</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A> url)</CODE> <BR> Returns an HTTPConnection.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getDefaultRequestProperty(java.lang.String)">getDefaultRequestProperty</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</CODE> <BR> Gets the value for a given default request header.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/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> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getHeaderField(int)">getHeaderField</A></B>(int n)</CODE> <BR> Gets header value of the n-th header.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getHeaderField(java.lang.String)">getHeaderField</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</CODE> <BR> Get the value part of a header.</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="../HTTPClient/HttpURLConnection.html#getHeaderFieldDate(java.lang.String, long)">getHeaderFieldDate</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, long def)</CODE> <BR> Get the value part of a header, interprets it as a date and converts it to a long representing the number of milliseconds since 1970.</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="../HTTPClient/HttpURLConnection.html#getHeaderFieldInt(java.lang.String, int)">getHeaderFieldInt</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, int def)</CODE> <BR> Get the value part of a header and converts it to an int.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getHeaderFieldKey(int)">getHeaderFieldKey</A></B>(int n)</CODE> <BR> Gets header name of the n-th header.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getInputStream()">getInputStream</A></B>()</CODE> <BR> Gets an input stream from which the data in the response may be read.</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="../HTTPClient/HttpURLConnection.html#getInstanceFollowRedirects()">getInstanceFollowRedirects</A></B>()</CODE> <BR> </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/OutputStream.html">OutputStream</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getOutputStream()">getOutputStream</A></B>()</CODE> <BR> Gets an output stream which can be used send an entity with the request.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getRequestMethod()">getRequestMethod</A></B>()</CODE> <BR> Return the request method used.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getRequestProperty(java.lang.String)">getRequestProperty</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</CODE> <BR> Gets the value of a given request header.</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="../HTTPClient/HttpURLConnection.html#getResponseCode()">getResponseCode</A></B>()</CODE> <BR> Get the response code.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getResponseMessage()">getResponseMessage</A></B>()</CODE> <BR> Get the response message describing the response code.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#getURL()">getURL</A></B>()</CODE> <BR> Gets the url for this connection.</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="../HTTPClient/HttpURLConnection.html#setDefaultRequestProperty(java.lang.String, java.lang.String)">setDefaultRequestProperty</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> value)</CODE> <BR> Sets an arbitrary default request header.</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="../HTTPClient/HttpURLConnection.html#setIfModifiedSince(long)">setIfModifiedSince</A></B>(long time)</CODE> <BR> Sets the <var>If-Modified-Since</var> header.</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="../HTTPClient/HttpURLConnection.html#setInstanceFollowRedirects(boolean)">setInstanceFollowRedirects</A></B>(boolean set)</CODE> <BR> Enables or disables the automatic handling of redirection responses for this instance only.</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="../HTTPClient/HttpURLConnection.html#setRequestMethod(java.lang.String)">setRequestMethod</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> method)</CODE> <BR> Sets the request method (e.g.</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="../HTTPClient/HttpURLConnection.html#setRequestProperty(java.lang.String, java.lang.String)">setRequestProperty</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> value)</CODE> <BR> Sets an arbitrary request header.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HttpURLConnection.html#toString()">toString</A></B>()</CODE> <BR> produces a string.</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="../HTTPClient/HttpURLConnection.html#usingProxy()">usingProxy</A></B>()</CODE> <BR> Shows if request are being made through an http proxy or directly.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.net.HttpURLConnection"><!-- --></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="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getFollowRedirects()">getFollowRedirects</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getPermission()">getPermission</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#setFollowRedirects(boolean)">setFollowRedirects</A></CODE></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="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getAllowUserInteraction()">getAllowUserInteraction</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getContent()">getContent</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getContentEncoding()">getContentEncoding</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getContentLength()">getContentLength</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getContentType()">getContentType</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getDate()">getDate</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getDefaultAllowUserInteraction()">getDefaultAllowUserInteraction</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getDefaultUseCaches()">getDefaultUseCaches</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getDoInput()">getDoInput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getDoOutput()">getDoOutput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getExpiration()">getExpiration</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getFileNameMap()">getFileNameMap</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getIfModifiedSince()">getIfModifiedSince</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getLastModified()">getLastModified</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getUseCaches()">getUseCaches</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#guessContentTypeFromName(java.lang.String)">guessContentTypeFromName</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#guessContentTypeFromStream(java.io.InputStream)">guessContentTypeFromStream</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setAllowUserInteraction(boolean)">setAllowUserInteraction</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setContentHandlerFactory(java.net.ContentHandlerFactory)">setContentHandlerFactory</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setDefaultAllowUserInteraction(boolean)">setDefaultAllowUserInteraction</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setDefaultUseCaches(boolean)">setDefaultUseCaches</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setDoInput(boolean)">setDoInput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setDoOutput(boolean)">setDoOutput</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setFileNameMap(java.net.FileNameMap)">setFileNameMap</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setUseCaches(boolean)">setUseCaches</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="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">Object</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#clone()">clone</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#finalize()">finalize</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/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="connections"><!-- --></A><H3> connections</H3> <PRE> protected static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/util/Hashtable.html">Hashtable</A> <B>connections</B></PRE> <DL> <DD>the cache of HTTPConnections</DL> <HR> <A NAME="con"><!-- --></A><H3> con</H3> <PRE> protected <A HREF="../HTTPClient/HTTPConnection.html">HTTPConnection</A> <B>con</B></PRE> <DL> <DD>the current connection</DL> <HR> <A NAME="resp"><!-- --></A><H3> resp</H3> <PRE> protected <A HREF="../HTTPClient/HTTPResponse.html">HTTPResponse</A> <B>resp</B></PRE> <DL> <DD>the response</DL> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TD> </TR> </TABLE> <A NAME="HttpURLConnection(java.net.URL)"><!-- --></A><H3> HttpURLConnection</H3> <PRE> public <B>HttpURLConnection</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A> url) throws <A HREF="../HTTPClient/ProtocolNotSuppException.html">ProtocolNotSuppException</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Construct a connection to the specified url. A cache of HTTPConnections is used to maximize the reuse of these across multiple HttpURLConnections. <BR>The default method is "GET".<DD><DL> <DT><B>Parameters:</B><DD><CODE>url</CODE> - the url of the request<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ProtocolNotSuppException.html">ProtocolNotSuppException</A> - if the protocol is not supported</DL> </DD> </DL> <!-- ============ 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="getConnection(java.net.URL)"><!-- --></A><H3> getConnection</H3> <PRE> protected <A HREF="../HTTPClient/HTTPConnection.html">HTTPConnection</A> <B>getConnection</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A> url) throws <A HREF="../HTTPClient/ProtocolNotSuppException.html">ProtocolNotSuppException</A></PRE> <DL> <DD>Returns an HTTPConnection. A cache of connections is kept and first consulted; only when the cache lookup fails is a new one created and added to the cache.<DD><DL> <DT><B>Parameters:</B><DD><CODE>url</CODE> - the url<DT><B>Returns:</B><DD>an HTTPConnection<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ProtocolNotSuppException.html">ProtocolNotSuppException</A> - if the protocol is not supported</DL> </DD> </DL> <HR> <A NAME="setRequestMethod(java.lang.String)"><!-- --></A><H3> setRequestMethod</H3> <PRE> public void <B>setRequestMethod</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> method) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/ProtocolException.html">ProtocolException</A></PRE> <DL> <DD>Sets the request method (e.g. "PUT" or "HEAD"). Can only be set before connect() is called.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#setRequestMethod(java.lang.String)">setRequestMethod</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>method</CODE> - the http method.<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/ProtocolException.html">ProtocolException</A> - if already connected.</DL> </DD> </DL> <HR> <A NAME="getRequestMethod()"><!-- --></A><H3> getRequestMethod</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getRequestMethod</B>()</PRE> <DL> <DD>Return the request method used.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getRequestMethod()">getRequestMethod</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the http method.</DL> </DD> </DL> <HR> <A NAME="getResponseCode()"><!-- --></A><H3> getResponseCode</H3> <PRE> public int <B>getResponseCode</B>() throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Get the response code. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getResponseCode()">getResponseCode</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the http response code returned.</DL> </DD> </DL> <HR> <A NAME="getResponseMessage()"><!-- --></A><H3> getResponseMessage</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getResponseMessage</B>() throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Get the response message describing the response code. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getResponseMessage()">getResponseMessage</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the http response message returned with the response code.</DL> </DD> </DL> <HR> <A NAME="getHeaderField(java.lang.String)"><!-- --></A><H3> getHeaderField</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getHeaderField</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</PRE> <DL> <DD>Get the value part of a header. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getHeaderField(java.lang.String)">getHeaderField</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the of the header.<DT><B>Returns:</B><DD>the value of the header, or null if no such header was returned.</DL> </DD> </DL> <HR> <A NAME="getHeaderFieldInt(java.lang.String, int)"><!-- --></A><H3> getHeaderFieldInt</H3> <PRE> public int <B>getHeaderFieldInt</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, int def)</PRE> <DL> <DD>Get the value part of a header and converts it to an int. If the header does not exist or if its value could not be converted to an int then the default is returned. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getHeaderFieldInt(java.lang.String, int)">getHeaderFieldInt</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the of the header.<DD><CODE>def</CODE> - the default value to return in case of an error.<DT><B>Returns:</B><DD>the value of the header, or null if no such header was returned.</DL> </DD> </DL> <HR> <A NAME="getHeaderFieldDate(java.lang.String, long)"><!-- --></A><H3> getHeaderFieldDate</H3> <PRE> public long <B>getHeaderFieldDate</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, long def)</PRE> <DL> <DD>Get the value part of a header, interprets it as a date and converts it to a long representing the number of milliseconds since 1970. If the header does not exist or if its value could not be converted to a date then the default is returned. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getHeaderFieldDate(java.lang.String, long)">getHeaderFieldDate</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the of the header.<DD><CODE>def</CODE> - the default value to return in case of an error.<DT><B>Returns:</B><DD>the value of the header, or def in case of an error.</DL> </DD> </DL> <HR> <A NAME="getHeaderFieldKey(int)"><!-- --></A><H3> getHeaderFieldKey</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getHeaderFieldKey</B>(int n)</PRE> <DL> <DD>Gets header name of the n-th header. Calls connect() if not connected. The name of the 0-th header is <var>null</var>, even though it the 0-th header has a value.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getHeaderFieldKey(int)">getHeaderFieldKey</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>n</CODE> - which header to return.<DT><B>Returns:</B><DD>the header name, or null if not that many headers.</DL> </DD> </DL> <HR> <A NAME="getHeaderField(int)"><!-- --></A><H3> getHeaderField</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getHeaderField</B>(int n)</PRE> <DL> <DD>Gets header value of the n-th header. Calls connect() if not connected. The value of 0-th header is the Status-Line (e.g. "HTTP/1.1 200 Ok").<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getHeaderField(int)">getHeaderField</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>n</CODE> - which header to return.<DT><B>Returns:</B><DD>the header value, or null if not that many headers.</DL> </DD> </DL> <HR> <A NAME="getInputStream()"><!-- --></A><H3> getInputStream</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A> <B>getInputStream</B>() throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Gets an input stream from which the data in the response may be read. Calls connect() if not connected.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getInputStream()">getInputStream</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>an InputStream<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/ProtocolException.html">ProtocolException</A> - if input not enabled.<DT><B>See Also: </B><DD><CODE>URLConnection.setDoInput(boolean)</CODE></DL> </DD> </DL> <HR> <A NAME="getErrorStream()"><!-- --></A><H3> getErrorStream</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A> <B>getErrorStream</B>()</PRE> <DL> <DD>Returns the error stream if the connection failed but the server sent useful data nonetheless. <P>This method will not cause a connection to be initiated.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#getErrorStream()">getErrorStream</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>an InputStream, or null if either the connection hasn't been established yet or no error occured<DT><B>Since: </B><DD>V0.3-1</DD> <DT><B>See Also: </B><DD><CODE>HttpURLConnection.getErrorStream()</CODE></DL> </DD> </DL> <HR> <A NAME="getOutputStream()"><!-- --></A><H3> getOutputStream</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/OutputStream.html">OutputStream</A> <B>getOutputStream</B>() throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Gets an output stream which can be used send an entity with the request. Can be called multiple times, in which case always the same stream is returned. <P>The default request method changes to "POST" when this method is called. Cannot be called after connect(). <P>If no Content-type has been set it defaults to <var>application/x-www-form-urlencoded</var>. Furthermore, if the Content-type is <var>application/x-www-form-urlencoded</var> then all output will be collected in a buffer before sending it to the server; otherwise an HttpOutputStream is used.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getOutputStream()">getOutputStream</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>an OutputStream<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/ProtocolException.html">ProtocolException</A> - if already connect()'ed, if output is not enabled or if the request method does not support output.<DT><B>See Also: </B><DD><CODE>URLConnection.setDoOutput(boolean)</CODE>, <A HREF="../HTTPClient/HttpOutputStream.html"><CODE>HttpOutputStream</CODE></A></DL> </DD> </DL> <HR> <A NAME="getURL()"><!-- --></A><H3> getURL</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URL.html">URL</A> <B>getURL</B>()</PRE> <DL> <DD>Gets the url for this connection. If we're connect()'d and the request was redirected then the url returned is that of the final request.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getURL()">getURL</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the final url, or null if any exception occured.</DL> </DD> </DL> <HR> <A NAME="setIfModifiedSince(long)"><!-- --></A><H3> setIfModifiedSince</H3> <PRE> public void <B>setIfModifiedSince</B>(long time)</PRE> <DL> <DD>Sets the <var>If-Modified-Since</var> header.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setIfModifiedSince(long)">setIfModifiedSince</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>time</CODE> - the number of milliseconds since 1970.</DL> </DD> </DL> <HR> <A NAME="setRequestProperty(java.lang.String, java.lang.String)"><!-- --></A><H3> setRequestProperty</H3> <PRE> public void <B>setRequestProperty</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> value)</PRE> <DL> <DD>Sets an arbitrary request header.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#setRequestProperty(java.lang.String, java.lang.String)">setRequestProperty</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header.<DD><CODE>value</CODE> - the value for the header.</DL> </DD> </DL> <HR> <A NAME="getRequestProperty(java.lang.String)"><!-- --></A><H3> getRequestProperty</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getRequestProperty</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</PRE> <DL> <DD>Gets the value of a given request header.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#getRequestProperty(java.lang.String)">getRequestProperty</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header.<DT><B>Returns:</B><DD>the value part of the header, or null if no such header.</DL> </DD> </DL> <HR> <A NAME="setDefaultRequestProperty(java.lang.String, java.lang.String)"><!-- --></A><H3> setDefaultRequestProperty</H3> <PRE> public static void <B>setDefaultRequestProperty</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> value)</PRE> <DL> <DD>Sets an arbitrary default request header. All headers set here are automatically sent with each request.<DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header.<DD><CODE>value</CODE> - the value for the header.</DL> </DD> </DL> <HR> <A NAME="getDefaultRequestProperty(java.lang.String)"><!-- --></A><H3> getDefaultRequestProperty</H3> <PRE> public static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>getDefaultRequestProperty</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> name)</PRE> <DL> <DD>Gets the value for a given default request header.<DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header.<DT><B>Returns:</B><DD>the value part of the header, or null if no such header.</DL> </DD> </DL> <HR> <A NAME="setInstanceFollowRedirects(boolean)"><!-- --></A><H3> setInstanceFollowRedirects</H3> <PRE> public void <B>setInstanceFollowRedirects</B>(boolean set)</PRE> <DL> <DD>Enables or disables the automatic handling of redirection responses for this instance only. Cannot be called after <code>connect()</code>.<DD><DL> <DT><B>Parameters:</B><DD><CODE>set</CODE> - enables automatic redirection handling if true.</DL> </DD> </DL> <HR> <A NAME="getInstanceFollowRedirects()"><!-- --></A><H3> getInstanceFollowRedirects</H3> <PRE> public boolean <B>getInstanceFollowRedirects</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>true if automatic redirection handling for this instance is enabled.</DL> </DD> </DL> <HR> <A NAME="connect()"><!-- --></A><H3> connect</H3> <PRE> public void <B>connect</B>() throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Connects to the server (if connection not still kept alive) and issues the request.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#connect()">connect</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> </DL> <HR> <A NAME="disconnect()"><!-- --></A><H3> disconnect</H3> <PRE> public void <B>disconnect</B>()</PRE> <DL> <DD>Closes all the connections to this server.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#disconnect()">disconnect</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> </DL> <HR> <A NAME="usingProxy()"><!-- --></A><H3> usingProxy</H3> <PRE> public boolean <B>usingProxy</B>()</PRE> <DL> <DD>Shows if request are being made through an http proxy or directly.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html#usingProxy()">usingProxy</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/HttpURLConnection.html">HttpURLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>true if an http proxy is being used.</DL> </DD> </DL> <HR> <A NAME="toString()"><!-- --></A><H3> toString</H3> <PRE> public <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>toString</B>()</PRE> <DL> <DD>produces a string.<DD><DL> <DT><B>Overrides:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html#toString()">toString</A> in class <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/net/URLConnection.html">URLConnection</A></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>a string containing the HttpURLConnection</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_bottom"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../HTTPClient/HTTPResponse.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/Log.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="HttpURLConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> </BODY> </HTML>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de