1 /* |
1 /* |
2 * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
660 * @param useCache whether the cached connection should be used |
660 * @param useCache whether the cached connection should be used |
661 * if present |
661 * if present |
662 */ |
662 */ |
663 protected void setNewClient (URL url, boolean useCache) |
663 protected void setNewClient (URL url, boolean useCache) |
664 throws IOException { |
664 throws IOException { |
665 http = HttpClient.New(url, null, -1, useCache, connectTimeout); |
665 http = HttpClient.New(url, null, -1, useCache, connectTimeout, this); |
666 http.setReadTimeout(readTimeout); |
666 http.setReadTimeout(readTimeout); |
667 } |
667 } |
668 |
668 |
669 |
669 |
670 /** |
670 /** |
701 |
701 |
702 protected void proxiedConnect(URL url, |
702 protected void proxiedConnect(URL url, |
703 String proxyHost, int proxyPort, |
703 String proxyHost, int proxyPort, |
704 boolean useCache) |
704 boolean useCache) |
705 throws IOException { |
705 throws IOException { |
706 http = HttpClient.New (url, proxyHost, proxyPort, useCache, connectTimeout); |
706 http = HttpClient.New (url, proxyHost, proxyPort, useCache, |
|
707 connectTimeout, this); |
707 http.setReadTimeout(readTimeout); |
708 http.setReadTimeout(readTimeout); |
708 } |
709 } |
709 |
710 |
710 protected HttpURLConnection(URL u, Handler handler) |
711 protected HttpURLConnection(URL u, Handler handler) |
711 throws IOException { |
712 throws IOException { |
992 } |
993 } |
993 |
994 |
994 // subclass HttpsClient will overwrite & return an instance of HttpsClient |
995 // subclass HttpsClient will overwrite & return an instance of HttpsClient |
995 protected HttpClient getNewHttpClient(URL url, Proxy p, int connectTimeout) |
996 protected HttpClient getNewHttpClient(URL url, Proxy p, int connectTimeout) |
996 throws IOException { |
997 throws IOException { |
997 return HttpClient.New(url, p, connectTimeout); |
998 return HttpClient.New(url, p, connectTimeout, this); |
998 } |
999 } |
999 |
1000 |
1000 // subclass HttpsClient will overwrite & return an instance of HttpsClient |
1001 // subclass HttpsClient will overwrite & return an instance of HttpsClient |
1001 protected HttpClient getNewHttpClient(URL url, Proxy p, |
1002 protected HttpClient getNewHttpClient(URL url, Proxy p, |
1002 int connectTimeout, boolean useCache) |
1003 int connectTimeout, boolean useCache) |
1003 throws IOException { |
1004 throws IOException { |
1004 return HttpClient.New(url, p, connectTimeout, useCache); |
1005 return HttpClient.New(url, p, connectTimeout, useCache, this); |
1005 } |
1006 } |
1006 |
1007 |
1007 private void expect100Continue() throws IOException { |
1008 private void expect100Continue() throws IOException { |
1008 // Expect: 100-Continue was set, so check the return code for |
1009 // Expect: 100-Continue was set, so check the return code for |
1009 // Acceptance |
1010 // Acceptance |