Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 package org.apache.xmlrpc.client;
00020
00021 import java.io.IOException;
00022 import java.net.Proxy;
00023 import java.net.URL;
00024 import java.net.URLConnection;
00025
00026 import javax.net.ssl.HttpsURLConnection;
00027 import javax.net.ssl.SSLSocketFactory;
00028
00029 import org.apache.xmlrpc.XmlRpcRequest;
00030
00031
00037 public class XmlRpcSun15HttpTransport extends XmlRpcSun14HttpTransport {
00042 public XmlRpcSun15HttpTransport(XmlRpcClient pClient) {
00043 super(pClient);
00044 }
00045
00046 private Proxy proxy;
00047
00051 public void setProxy(Proxy pProxy) {
00052 proxy = pProxy;
00053 }
00054
00058 public Proxy getProxy() {
00059 return proxy;
00060 }
00061
00062 protected void initHttpHeaders(XmlRpcRequest pRequest)
00063 throws XmlRpcClientException {
00064 final XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
00065 int connectionTimeout = config.getConnectionTimeout();
00066 if (connectionTimeout > 0) {
00067 getURLConnection().setConnectTimeout(connectionTimeout);
00068 }
00069 int replyTimeout = config.getReplyTimeout();
00070 if (replyTimeout > 0) {
00071 getURLConnection().setReadTimeout(replyTimeout);
00072 }
00073 super.initHttpHeaders(pRequest);
00074 }
00075
00076 protected URLConnection newURLConnection(URL pURL) throws IOException {
00077 final Proxy prox = getProxy();
00078 final URLConnection conn = prox == null ? pURL.openConnection() : pURL.openConnection(prox);
00079 final SSLSocketFactory sslSockFactory = getSSLSocketFactory();
00080 if (sslSockFactory != null && conn instanceof HttpsURLConnection) {
00081 ((HttpsURLConnection)conn).setSSLSocketFactory(sslSockFactory);
00082 }
00083 return conn;
00084 }
00085 }