XmlRpcSun15HttpTransport.java
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one
00003  * or more contributor license agreements.  See the NOTICE file
00004  * distributed with this work for additional information
00005  * regarding copyright ownership.  The ASF licenses this file
00006  * to you under the Apache License, Version 2.0 (the
00007  * "License"); you may not use this file except in compliance
00008  * with the License.  You may obtain a copy of the License at
00009  *
00010  *   http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing,
00013  * software distributed under the License is distributed on an
00014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015  * KIND, either express or implied.  See the License for the
00016  * specific language governing permissions and limitations
00017  * under the License.    
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 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49