blob: 20d47728552ce08d780ed374cc2088cbb8f5cf23 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>HttpClient Tutorial</title><link rel="stylesheet" type="text/css" href="css/hc-tutorial.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="index.html" title="HttpClient Tutorial"><link rel="next" href="preface.html" title="Preface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns:fo="http://www.w3.org/1999/XSL/Format" class="banner"><a class="bannerLeft" href="http://www.apache.org/" title="Apache Software Foundation"><img style="border:none;" src="images/asf_logo_wide.gif"></a><a class="bannerRight" href="http://hc.apache.org/httpcomponents-client-ga/" title="Apache HttpComponents Client"><img style="border:none;" src="images/hc_logo.png"></a><div class="clear"></div></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">HttpClient Tutorial</th></tr><tr><td width="20%" align="left">&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="preface.html">Next</a></td></tr></table><hr></div><div class="book" title="HttpClient Tutorial"><div class="titlepage"><div><div><h1 class="title"><a name="d5e1"></a>HttpClient Tutorial</h1></div><div><div class="authorgroup">
<div class="author"><h3 class="author"><span class="firstname">Oleg</span> <span class="surname">Kalnichevski</span></h3></div>
</div></div><div><p class="releaseinfo">4.2.2</p></div><div><div class="legalnotice" title="Legal Notice"><a name="d5e9"></a>
<p>
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
</p>
<p>
<a class="ulink" href="http://www.apache.org/licenses/LICENSE-2.0" target="_top">http://www.apache.org/licenses/LICENSE-2.0</a>
</p>
<p>
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
</p>
</div></div></div><hr></div><div class="toc"><dl><dt><span class="preface"><a href="preface.html">Preface</a></span></dt><dd><dl><dt><span class="section"><a href="preface.html#d5e20">1. HttpClient scope</a></span></dt><dt><span class="section"><a href="preface.html#d5e30">2. What HttpClient is NOT</a></span></dt></dl></dd><dt><span class="chapter"><a href="fundamentals.html">1. Fundamentals</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e37">1.1. Request execution</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e43">1.1.1. HTTP request</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e68">1.1.2. HTTP response</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e74">1.1.3. Working with message headers</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e89">1.1.4. HTTP entity</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e113">1.1.4.1. Repeatable entities</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e118">1.1.4.2. Using HTTP entities</a></span></dt></dl></dd><dt><span class="section"><a href="fundamentals.html#d5e139">1.1.5. Ensuring release of low level resources</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e153">1.1.6. Consuming entity content</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e165">1.1.7. Producing entity content</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e180">1.1.7.1. HTML forms</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e188">1.1.7.2. Content chunking</a></span></dt></dl></dd><dt><span class="section"><a href="fundamentals.html#d5e193">1.1.8. Response handlers</a></span></dt></dl></dd><dt><span class="section"><a href="fundamentals.html#d5e200">1.2. HTTP execution context</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e249">1.3. Exception handling</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e254">1.3.1. HTTP transport safety</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e258">1.3.2. Idempotent methods</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e270">1.3.3. Automatic exception recovery</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e281">1.3.4. Request retry handler</a></span></dt></dl></dd><dt><span class="section"><a href="fundamentals.html#d5e286">1.4. Aborting requests</a></span></dt><dt><span class="section"><a href="fundamentals.html#protocol_interceptors">1.5. HTTP protocol interceptors</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e299">1.6. HTTP parameters</a></span></dt><dd><dl><dt><span class="section"><a href="fundamentals.html#d5e317">1.6.1. Parameter hierarchies</a></span></dt><dt><span class="section"><a href="fundamentals.html#d5e328">1.6.2. HTTP parameters beans</a></span></dt></dl></dd><dt><span class="section"><a href="fundamentals.html#d5e338">1.7. HTTP request execution parameters</a></span></dt></dl></dd><dt><span class="chapter"><a href="connmgmt.html">2. Connection management</a></span></dt><dd><dl><dt><span class="section"><a href="connmgmt.html#d5e399">2.1. Connection parameters</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e463">2.2. Connection persistence</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e467">2.3. HTTP connection routing</a></span></dt><dd><dl><dt><span class="section"><a href="connmgmt.html#d5e471">2.3.1. Route computation</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e487">2.3.2. Secure HTTP connections</a></span></dt></dl></dd><dt><span class="section"><a href="connmgmt.html#d5e490">2.4. HTTP route parameters</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e512">2.5. Socket factories</a></span></dt><dd><dl><dt><span class="section"><a href="connmgmt.html#d5e520">2.5.1. Secure socket layering</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e526">2.5.2. SSL/TLS customization</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e535">2.5.3. Hostname verification</a></span></dt></dl></dd><dt><span class="section"><a href="connmgmt.html#d5e563">2.6. Protocol schemes</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e571">2.7. HttpClient proxy configuration</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e581">2.8. HTTP connection managers</a></span></dt><dd><dl><dt><span class="section"><a href="connmgmt.html#d5e583">2.8.1. Connection operators</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e594">2.8.2. Managed connections and connection managers</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e619">2.8.3. Simple connection manager</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e627">2.8.4. Pooling connection manager</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e635">2.8.5. Connection manager shutdown</a></span></dt></dl></dd><dt><span class="section"><a href="connmgmt.html#d5e639">2.9. Multithreaded request execution</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e652">2.10. Connection eviction policy</a></span></dt><dt><span class="section"><a href="connmgmt.html#d5e659">2.11. Connection keep alive strategy</a></span></dt></dl></dd><dt><span class="chapter"><a href="statemgmt.html">3. HTTP state management</a></span></dt><dd><dl><dt><span class="section"><a href="statemgmt.html#d5e669">3.1. HTTP cookies</a></span></dt><dd><dl><dt><span class="section"><a href="statemgmt.html#d5e686">3.1.1. Cookie versions</a></span></dt></dl></dd><dt><span class="section"><a href="statemgmt.html#d5e696">3.2. Cookie specifications</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e739">3.3. HTTP cookie and state management parameters</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e770">3.4. Cookie specification registry</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e799">3.5. Choosing cookie policy</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e803">3.6. Custom cookie policy</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e809">3.7. Cookie persistence</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e818">3.8. HTTP state management and execution context</a></span></dt><dt><span class="section"><a href="statemgmt.html#d5e849">3.9. Per user / thread state management</a></span></dt></dl></dd><dt><span class="chapter"><a href="authentication.html">4. HTTP authentication</a></span></dt><dd><dl><dt><span class="section"><a href="authentication.html#d5e858">4.1. User credentials</a></span></dt><dt><span class="section"><a href="authentication.html#d5e870">4.2. Authentication schemes</a></span></dt><dt><span class="section"><a href="authentication.html#d5e912">4.3. HTTP authentication parameters</a></span></dt><dt><span class="section"><a href="authentication.html#d5e947">4.4. Authentication scheme registry</a></span></dt><dt><span class="section"><a href="authentication.html#d5e972">4.5. Credentials provider</a></span></dt><dt><span class="section"><a href="authentication.html#d5e983">4.6. HTTP authentication and execution context</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1029">4.7. Caching of authentication data</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1032">4.8. Preemptive authentication</a></span></dt><dt><span class="section"><a href="authentication.html#ntlm">4.9. NTLM Authentication</a></span></dt><dd><dl><dt><span class="section"><a href="authentication.html#d5e1043">4.9.1. NTLM connection persistence</a></span></dt></dl></dd><dt><span class="section"><a href="authentication.html#spnego">4.10. <code class="literal">SPNEGO</code>/Kerberos Authentication</a></span></dt><dd><dl><dt><span class="section"><a href="authentication.html#d5e1094">4.10.1. <code class="literal">SPNEGO</code> support in HttpClient</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1110">4.10.2. GSS/Java Kerberos Setup</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1118">4.10.3. <code class="literal">login.conf</code> file</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1130">4.10.4. <code class="literal">krb5.conf</code> / <code class="literal">krb5.ini</code> file</a></span></dt><dt><span class="section"><a href="authentication.html#d5e1140">4.10.5. Windows Specific configuration</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="httpagent.html">5. HTTP client service</a></span></dt><dd><dl><dt><span class="section"><a href="httpagent.html#d5e1152">5.1. HttpClient facade</a></span></dt><dt><span class="section"><a href="httpagent.html#d5e1169">5.2. HttpClient parameters</a></span></dt><dt><span class="section"><a href="httpagent.html#d5e1225">5.3. Automatic redirect handling</a></span></dt><dt><span class="section"><a href="httpagent.html#d5e1232">5.4. HTTP client and execution context</a></span></dt><dt><span class="section"><a href="httpagent.html#d5e1238">5.5. Compressed response content</a></span></dt></dl></dd><dt><span class="chapter"><a href="fluent.html">6. Fluent API</a></span></dt><dd><dl><dt><span class="section"><a href="fluent.html#d5e1259">6.1. Easy to use facade API</a></span></dt><dd><dl><dt><span class="section"><a href="fluent.html#d5e1269">6.1.1. Response handling</a></span></dt><dt><span class="section"><a href="fluent.html#d5e1274">6.1.2. Asynchronous execution</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="caching.html">7. HTTP Caching</a></span></dt><dd><dl><dt><span class="section"><a href="caching.html#generalconcepts">7.1. General Concepts</a></span></dt><dt><span class="section"><a href="caching.html#rfc2616compliance">7.2. RFC-2616 Compliance</a></span></dt><dt><span class="section"><a href="caching.html#d5e1317">7.3. Example Usage</a></span></dt><dt><span class="section"><a href="caching.html#configuration">7.4. Configuration</a></span></dt><dt><span class="section"><a href="caching.html#storage">7.5. Storage Backends</a></span></dt></dl></dd><dt><span class="chapter"><a href="advanced.html">8. Advanced topics</a></span></dt><dd><dl><dt><span class="section"><a href="advanced.html#d5e1339">8.1. Custom client connections</a></span></dt><dt><span class="section"><a href="advanced.html#stateful_conn">8.2. Stateful HTTP connections</a></span></dt><dd><dl><dt><span class="section"><a href="advanced.html#d5e1365">8.2.1. User token handler</a></span></dt><dt><span class="section"><a href="advanced.html#d5e1375">8.2.2. User token and execution context</a></span></dt><dd><dl><dt><span class="section"><a href="advanced.html#d5e1387">8.2.2.1. Persistent stateful connections</a></span></dt></dl></dd></dl></dd></dl></dd></dl></div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="preface.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right" valign="top">&nbsp;Preface</td></tr></table></div></body></html>