1166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath<!DOCTYPE html>
2166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath<html lang="en">
3166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  <head>
4166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <meta charset="utf-8">
5166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <title>OkHttp</title>
6166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <meta name="description" content="An HTTP &amp; SPDY client for Android and Java applications">
8166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <link href="static/bootstrap-combined.min.css" rel="stylesheet">
9166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <link href="static/app.css" rel="stylesheet">
10166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <link href="static/app-theme.css" rel="stylesheet">
11166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <link href="http://fonts.googleapis.com/css?family=Roboto:400,300italic,100,100italic,300" rel="stylesheet" type="text/css">
12166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <!--[if lt IE 9]><script src="static/html5shiv.min.js"></script><![endif]-->
13166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  </head>
14166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  <body data-target=".content-nav">
15166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <header>
16166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      <div class="container">
17166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        <div class="row">
18166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span5">
19166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h1>OkHttp</h1>
20166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
21166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span7">
22166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <menu>
23166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              <ul>
24166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#download" class="menu download">Download <span class="version-tag">Latest</span></a></li>
25166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="http://github.com/square/okhttp" data-title="View GitHub Project" class="menu github"><img src="static/icon-github.png" alt="GitHub"/></a></li>
26166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="http://square.github.io/" data-title="Square Open Source Portal" class="menu square"><img src="static/icon-square.png" alt="Square"/></a></li>
27166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              </ul>
28166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            </menu>
29166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
30166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      </div>
31166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    </header>
32166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <section id="subtitle">
33166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      <div class="container">
34166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        <div class="row">
35166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span12">
36166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h2>An <strong>HTTP &amp; SPDY</strong> client for Android and Java applications</h2>
37166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
38166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        </div>
39166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      </div>
40166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    </section>
41166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <section id="body">
42166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      <div class="container">
43166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        <div class="row">
44166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span9">
45166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h3 id="overview">Overview</h3>
46166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>HTTP is the way modern applications network. It’s how we exchange data & media.
47166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Doing HTTP efficiently makes your stuff load faster and saves bandwidth.</p>
48166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
49166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>OkHttp is an HTTP client that’s efficient by default:</p>
50166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <ul>
51166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li>SPDY support allows all requests to the same host to share a socket.</li>
52166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li>Connection pooling reduces request latency (if SPDY isn’t available).</li>
53166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li>Transparent GZIP shrinks download sizes.</li>
54166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li>Response caching avoids the network completely for repeat requests.</li>
55166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            </ul>
56166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
57166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>OkHttp perseveres when the network is troublesome: it will silently recover from
58166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                common connection problems. If your service has multiple IP addresses OkHttp will
59166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                attempt alternate addresses if the first connect fails. This is necessary for IPv4+IPv6
60166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                and for services hosted in redundant data centers. OkHttp also recovers from problematic
61166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                proxy servers and failed SSL handshakes.</p>
62166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
63166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>You can try OkHttp without rewriting your network code. The core module implements
64166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                the familiar <code>java.net.HttpURLConnection</code> API. And the optional
65166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                okhttp-apache module implements the Apache <code>HttpClient</code> API.</p>
66166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
67166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>OkHttp supports Android 2.2 and above. For Java, the minimum requirement is 1.5.</p>
68166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
69166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h3 id="examples">Examples</h3>
70166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h4>Get a URL</h4>
71166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>This program downloads a URL and print its contents as a string. <a href="https://raw.github.com/square/okhttp/master/samples/guide/src/main/java/com/squareup/okhttp/guide/GetExample.java">Full source</a>.
72166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath<pre class="prettyprint">
73166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    OkHttpClient client = new OkHttpClient();
74166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
75166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    String get(URL url) throws IOException {
76166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      HttpURLConnection connection = client.open(url);
77166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      InputStream in = null;
78166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      try {
79166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Read the response.
80166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        in = connection.getInputStream();
81166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        byte[] response = readFully(in);
82166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        return new String(response, "UTF-8");
83166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      } finally {
84166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        if (in != null) in.close();
85166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      }
86166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    }
87166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath</pre>
88166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h4>Post to a Server</h4>
89166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>This program posts data to a service. <a href="https://raw.github.com/square/okhttp/master/samples/guide/src/main/java/com/squareup/okhttp/guide/PostExample.java">Full source</a>.
90166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
91166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath<pre class="prettyprint">
92166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    OkHttpClient client = new OkHttpClient();
93166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
94166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    String post(URL url, byte[] body) throws IOException {
95166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      HttpURLConnection connection = client.open(url);
96166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      OutputStream out = null;
97166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      InputStream in = null;
98166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      try {
99166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Write the request.
100166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        connection.setRequestMethod("POST");
101166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        out = connection.getOutputStream();
102166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        out.write(body);
103166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        out.close();
104166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
105166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Read the response.
106166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
107166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          throw new IOException("Unexpected HTTP response: "
108166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              + connection.getResponseCode() + " " + connection.getResponseMessage());
109166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        }
110166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        in = connection.getInputStream();
111166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        return readFirstLine(in);
112166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      } finally {
113166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Clean up.
114166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        if (out != null) out.close();
115166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        if (in != null) in.close();
116166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      }
117166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    }
118166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath</pre>
119166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
120166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <!--
121166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                TODO
122166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Error Handling
123166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Authentication
124166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Cookies
125166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Response Caching
126166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                Captive Gateways
127166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                -->
128166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
129166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h3 id="download">Download</h3>
1304944713f5c5b141966ac82973d6a31a634e8e01eNeil Fuller            <p><a href="http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.squareup.okhttp&a=okhttp&v=LATEST" class="dl version-href">&darr; <span class="version-tag">Latest</span> JAR</a></p>
131166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>The source code to the OkHttp, its samples, and this website is <a href="http://github.com/square/okhttp">available on GitHub</a>.</p>
132166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
133166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h4>Maven</h4>
134166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <pre class="prettyprint">&lt;dependency>
135166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  &lt;groupId>com.squareup.okhttp&lt;/groupId>
136166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  &lt;artifactId>okhttp&lt;/artifactId>
137166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  &lt;version><span class="version pln"><em>(insert latest version)</em></span>&lt;/version>
138166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath&lt;/dependency></pre>
139166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
140166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h3 id="contributing">Contributing</h3>
141166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.</p>
142166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running <code>mvn clean verify</code>.</p>
143166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <p>Before your code can be accepted into the project you must also sign the <a href="http://squ.re/sign-the-cla">Individual Contributor License Agreement (CLA)</a>.</p>
144166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
145166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <h3 id="license">License</h3>
146166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <pre>Copyright 2013 Square, Inc.
147166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
148166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan KamathLicensed under the Apache License, Version 2.0 (the "License");
149166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamathyou may not use this file except in compliance with the License.
150166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan KamathYou may obtain a copy of the License at
151166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
152166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath   http://www.apache.org/licenses/LICENSE-2.0
153166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
154166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan KamathUnless required by applicable law or agreed to in writing, software
155166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamathdistributed under the License is distributed on an "AS IS" BASIS,
156166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan KamathWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan KamathSee the License for the specific language governing permissions and
158166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamathlimitations under the License.</pre>
159166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
160166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span3">
161166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <div class="content-nav" data-spy="affix" data-offset-top="80">
162166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              <ul class="nav nav-tabs nav-stacked primary">
163166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#overview">Overview</a></li>
164166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#examples">Examples</a></li>
165166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#download">Download</a></li>
166166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#contributing">Contributing</a></li>
167166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="#license">License</a></li>
168166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              </ul>
169166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              <ul class="nav nav-pills nav-stacked secondary">
170166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath                <li><a href="javadoc/index.html">Javadoc</a></li>
1713c938a3f6b61ce5e2dba0d039b03fe73b89fd26cNeil Fuller                <li><a href="http://stackoverflow.com/questions/tagged/okhttp?sort=active">StackOverflow</a></li>
172166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath              </ul>
173166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            </div>
174166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
175166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        </div>
176166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        <div class="row">
177166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          <div class="span12 logo">
178166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            <a href="https://squareup.com"><img src="static/logo-square.png" alt="Square, Inc."/></a>
179166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          </div>
180166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        </div>
181166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      </div>
182166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    </section>
183166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
184166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script src="static/bootstrap.min.js"></script>
185166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script src="static/jquery.smooth-scroll.min.js"></script>
186166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script src="static/jquery-maven-artifact.min.js"></script>
187166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script src="static/prettify.js"></script>
188166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    <script type="text/javascript">
189166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      $(function() {
190166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Syntax highlight code blocks.
191166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        prettyPrint();
192166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
193166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Spy on scroll position for real-time updating of current section.
194166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        $('body').scrollspy();
195166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
196166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Use smooth-scroll for internal links.
197166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        $('a').smoothScroll();
198166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
199166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Enable tooltips on the header nav image items.
200166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        $('.menu').tooltip({
201166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          placement: 'bottom',
202166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          trigger: 'hover',
203166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          container: 'body',
204166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          delay: {
205166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            show: 500,
206166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath            hide: 0
207166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          }
208166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        });
209166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
210166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        // Look up the latest version of the library.
211166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        $.fn.artifactVersion({
212166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          'groupId': 'com.squareup.okhttp',
213c6bd683320121544811f481709b3fdbcbe9b3866Neil Fuller          'artifactId': 'okhttp'
214166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        }, function(version, url) {
215166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          $('.version').text(version);
216166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          $('.version-tag').text('v' + version);
217166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath          $('.version-href').attr('href', url);
218166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        });
219166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      });
220166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
221166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      var _gaq = _gaq || [];
222166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      _gaq.push(['_setAccount', 'UA-40704740-2']);
223166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      _gaq.push(['_trackPageview']);
224166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath
225166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      (function() {
226166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
227166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
228166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
229166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath      })();
230166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath    </script>
231166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath  </body>
232166772be0e5cfdaea1a64b9f63e4c8dbfe48cba3Narayan Kamath</html>
233