5
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2 <!--NewPage-->
|
|
3 <HTML>
|
|
4 <HEAD>
|
|
5 <!-- Generated by javadoc (build 1.5.0_11) on Sat Aug 23 11:49:52 GMT+01:00 2008 -->
|
|
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
7 <TITLE>
|
|
8 org.apache.http.client (HttpClient 4.0-beta1 API)
|
|
9 </TITLE>
|
|
10
|
|
11 <META NAME="keywords" CONTENT="org.apache.http.client package">
|
|
12
|
|
13 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
|
|
14
|
|
15 <SCRIPT type="text/javascript">
|
|
16 function windowTitle()
|
|
17 {
|
|
18 parent.document.title="org.apache.http.client (HttpClient 4.0-beta1 API)";
|
|
19 }
|
|
20 </SCRIPT>
|
|
21 <NOSCRIPT>
|
|
22 </NOSCRIPT>
|
|
23
|
|
24 </HEAD>
|
|
25
|
|
26 <BODY BGCOLOR="white" onload="windowTitle();">
|
|
27
|
|
28
|
|
29 <!-- ========= START OF TOP NAVBAR ======= -->
|
|
30 <A NAME="navbar_top"><!-- --></A>
|
|
31 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
32 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
33 <TR>
|
|
34 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
35 <A NAME="navbar_top_firstrow"><!-- --></A>
|
|
36 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
37 <TR ALIGN="center" VALIGN="top">
|
|
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
|
|
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
|
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
46 </TR>
|
|
47 </TABLE>
|
|
48 </TD>
|
|
49 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
50 </EM>
|
|
51 </TD>
|
|
52 </TR>
|
|
53
|
|
54 <TR>
|
|
55 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
56 <A HREF="../../../../org/apache/http/auth/params/package-summary.html"><B>PREV PACKAGE</B></A>
|
|
57 <A HREF="../../../../org/apache/http/client/entity/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
|
|
58 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
59 <A HREF="../../../../index.html?org/apache/http/client/package-summary.html" target="_top"><B>FRAMES</B></A>
|
|
60 <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
|
|
61 <SCRIPT type="text/javascript">
|
|
62 <!--
|
|
63 if(window==top) {
|
|
64 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
65 }
|
|
66 //-->
|
|
67 </SCRIPT>
|
|
68 <NOSCRIPT>
|
|
69 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
70 </NOSCRIPT>
|
|
71
|
|
72
|
|
73 </FONT></TD>
|
|
74 </TR>
|
|
75 </TABLE>
|
|
76 <A NAME="skip-navbar_top"></A>
|
|
77 <!-- ========= END OF TOP NAVBAR ========= -->
|
|
78
|
|
79 <HR>
|
|
80 <H2>
|
|
81 Package org.apache.http.client
|
|
82 </H2>
|
|
83 The API for client-side HTTP communication and
|
|
84 entry point to the <i>HttpClient</i> module.
|
|
85 <P>
|
|
86 <B>See:</B>
|
|
87 <BR>
|
|
88 <A HREF="#package_description"><B>Description</B></A>
|
|
89 <P>
|
|
90
|
|
91 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
92 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
93 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
94 <B>Interface Summary</B></FONT></TH>
|
|
95 </TR>
|
|
96 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
97 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/AuthenticationHandler.html" title="interface in org.apache.http.client">AuthenticationHandler</A></B></TD>
|
|
98 <TD> </TD>
|
|
99 </TR>
|
|
100 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
101 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/CookieStore.html" title="interface in org.apache.http.client">CookieStore</A></B></TD>
|
|
102 <TD>Abstract cookie store.</TD>
|
|
103 </TR>
|
|
104 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
105 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/CredentialsProvider.html" title="interface in org.apache.http.client">CredentialsProvider</A></B></TD>
|
|
106 <TD>Abstract credentials provider.</TD>
|
|
107 </TR>
|
|
108 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
109 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/HttpClient.html" title="interface in org.apache.http.client">HttpClient</A></B></TD>
|
|
110 <TD>Interface for an HTTP client.</TD>
|
|
111 </TR>
|
|
112 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
113 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/HttpRequestRetryHandler.html" title="interface in org.apache.http.client">HttpRequestRetryHandler</A></B></TD>
|
|
114 <TD>A handler for determining if an HttpRequest should be retried after a
|
|
115 recoverable exception during execution.</TD>
|
|
116 </TR>
|
|
117 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
118 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/RedirectHandler.html" title="interface in org.apache.http.client">RedirectHandler</A></B></TD>
|
|
119 <TD>A handler for determining if an HTTP request should be redirected to
|
|
120 a new location in response to an HTTP response received from the target
|
|
121 server.</TD>
|
|
122 </TR>
|
|
123 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
124 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/RequestDirector.html" title="interface in org.apache.http.client">RequestDirector</A></B></TD>
|
|
125 <TD>A client-side request director.</TD>
|
|
126 </TR>
|
|
127 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
128 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/ResponseHandler.html" title="interface in org.apache.http.client">ResponseHandler<T></A></B></TD>
|
|
129 <TD>Handler that encapsulates the process of generating a response object
|
|
130 from a <CODE>HttpResponse</CODE>.</TD>
|
|
131 </TR>
|
|
132 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
133 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/UserTokenHandler.html" title="interface in org.apache.http.client">UserTokenHandler</A></B></TD>
|
|
134 <TD>A handler for determining if the given execution context is user specific
|
|
135 or not.</TD>
|
|
136 </TR>
|
|
137 </TABLE>
|
|
138
|
|
139
|
|
140 <P>
|
|
141
|
|
142 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
143 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
144 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
145 <B>Exception Summary</B></FONT></TH>
|
|
146 </TR>
|
|
147 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
148 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/CircularRedirectException.html" title="class in org.apache.http.client">CircularRedirectException</A></B></TD>
|
|
149 <TD>Signals a circular redirect</TD>
|
|
150 </TR>
|
|
151 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
152 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/ClientProtocolException.html" title="class in org.apache.http.client">ClientProtocolException</A></B></TD>
|
|
153 <TD>Signals an error in the HTTP protocol.</TD>
|
|
154 </TR>
|
|
155 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
156 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/HttpResponseException.html" title="class in org.apache.http.client">HttpResponseException</A></B></TD>
|
|
157 <TD>Signals a non 2xx HTTP response.</TD>
|
|
158 </TR>
|
|
159 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
160 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/NonRepeatableRequestException.html" title="class in org.apache.http.client">NonRepeatableRequestException</A></B></TD>
|
|
161 <TD>Signals failure to retry the request due to non-repeatable request
|
|
162 entity.</TD>
|
|
163 </TR>
|
|
164 <TR BGCOLOR="white" CLASS="TableRowColor">
|
|
165 <TD WIDTH="15%"><B><A HREF="../../../../org/apache/http/client/RedirectException.html" title="class in org.apache.http.client">RedirectException</A></B></TD>
|
|
166 <TD>Signals violation of HTTP specification caused by an invalid redirect</TD>
|
|
167 </TR>
|
|
168 </TABLE>
|
|
169
|
|
170
|
|
171 <P>
|
|
172 <A NAME="package_description"><!-- --></A><H2>
|
|
173 Package org.apache.http.client Description
|
|
174 </H2>
|
|
175
|
|
176 <P>
|
|
177 The API for client-side HTTP communication and
|
|
178 entry point to the <i>HttpClient</i> module.
|
|
179 <p/>
|
|
180 The usual execution flow can be demonstrated by the
|
|
181 code snippet below:
|
|
182
|
|
183 <PRE>
|
|
184 HttpClient httpclient = new DefaultHttpClient();
|
|
185
|
|
186 // Prepare a request object
|
|
187 HttpGet httpget = new HttpGet("http://www.apache.org/");
|
|
188
|
|
189 // Execute the request
|
|
190 HttpResponse response = httpclient.execute(httpget);
|
|
191
|
|
192 // Examine the response status
|
|
193 System.out.println(response.getStatusLine());
|
|
194
|
|
195 // Get hold of the response entity
|
|
196 HttpEntity entity = response.getEntity();
|
|
197
|
|
198 // If the response does not enclose an entity, there is no need
|
|
199 // to worry about connection release
|
|
200 if (entity != null) {
|
|
201 InputStream instream = entity.getContent();
|
|
202 try {
|
|
203
|
|
204 BufferedReader reader = new BufferedReader(
|
|
205 new InputStreamReader(instream));
|
|
206 // do something useful with the response
|
|
207 System.out.println(reader.readLine());
|
|
208
|
|
209 } catch (IOException ex) {
|
|
210
|
|
211 // In case of an IOException the connection will be released
|
|
212 // back to the connection manager automatically
|
|
213 throw ex;
|
|
214
|
|
215 } catch (RuntimeException ex) {
|
|
216
|
|
217 // In case of an unexpected exception you may want to abort
|
|
218 // the HTTP request in order to shut down the underlying
|
|
219 // connection and release it back to the connection manager.
|
|
220 httpget.abort();
|
|
221 throw ex;
|
|
222
|
|
223 } finally {
|
|
224
|
|
225 // Closing the input stream will trigger connection release
|
|
226 instream.close();
|
|
227
|
|
228 }
|
|
229 }
|
|
230
|
|
231 </PRE>
|
|
232 <P>
|
|
233
|
|
234 <P>
|
|
235 <DL>
|
|
236 </DL>
|
|
237 <HR>
|
|
238
|
|
239
|
|
240 <!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
241 <A NAME="navbar_bottom"><!-- --></A>
|
|
242 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
243 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
244 <TR>
|
|
245 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
246 <A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
247 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
248 <TR ALIGN="center" VALIGN="top">
|
|
249 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
250 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
|
|
251 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
|
252 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
253 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
254 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
255 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
256 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
257 </TR>
|
|
258 </TABLE>
|
|
259 </TD>
|
|
260 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
261 </EM>
|
|
262 </TD>
|
|
263 </TR>
|
|
264
|
|
265 <TR>
|
|
266 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
267 <A HREF="../../../../org/apache/http/auth/params/package-summary.html"><B>PREV PACKAGE</B></A>
|
|
268 <A HREF="../../../../org/apache/http/client/entity/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
|
|
269 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
270 <A HREF="../../../../index.html?org/apache/http/client/package-summary.html" target="_top"><B>FRAMES</B></A>
|
|
271 <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
|
|
272 <SCRIPT type="text/javascript">
|
|
273 <!--
|
|
274 if(window==top) {
|
|
275 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
276 }
|
|
277 //-->
|
|
278 </SCRIPT>
|
|
279 <NOSCRIPT>
|
|
280 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
281 </NOSCRIPT>
|
|
282
|
|
283
|
|
284 </FONT></TD>
|
|
285 </TR>
|
|
286 </TABLE>
|
|
287 <A NAME="skip-navbar_bottom"></A>
|
|
288 <!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
289
|
|
290 <HR>
|
|
291 Copyright © 1999-2008 <a href="http://www.apache.org/">Apache Software Foundation</a>. All Rights Reserved.
|
|
292 </BODY>
|
|
293 </HTML>
|