diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-08 23:45:29 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-12-08 23:45:29 +0000 |
commit | ad5fdef89966e011f61503244831225c0b9bdb6f (patch) | |
tree | 33bf75a188df478ddac1c77690dbc27d50f14b20 /sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src | |
parent | 92af2b263ee06d75adad9256ec9d22cdf751efb9 (diff) |
Move HttpClientFactory from common-http to host-http
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1043774 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java index e04065eed2..d0b24a0253 100644 --- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java @@ -19,21 +19,9 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider; -import org.apache.http.HttpHost; import org.apache.http.client.HttpClient; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.PlainSocketFactory; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.params.HttpParams; -import org.apache.http.params.HttpProtocolParams; -import org.apache.http.protocol.HTTP; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.host.http.client.HttpClientFactory; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; @@ -58,6 +46,7 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider this.endpointReference = endpointReference; this.reference = (RuntimeComponentReference)endpointReference.getReference(); + //clone the service contract to avoid databinding issues /* try { @@ -73,24 +62,6 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider // httpClient = createHttpClient(); } - public HttpClient createHttpClient() { - HttpParams defaultParameters = new BasicHttpParams(); - //defaultParameters.setIntParameter(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, 10); - HttpProtocolParams.setContentCharset(defaultParameters, HTTP.UTF_8); - HttpConnectionParams.setConnectionTimeout(defaultParameters, 60000); - HttpConnectionParams.setSoTimeout(defaultParameters, 60000); - - SchemeRegistry supportedSchemes = new SchemeRegistry(); - supportedSchemes.register(new Scheme(HttpHost.DEFAULT_SCHEME_NAME, PlainSocketFactory.getSocketFactory(), 80)); - supportedSchemes - .register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); - - ClientConnectionManager connectionManager = - new ThreadSafeClientConnManager(defaultParameters, supportedSchemes); - - return new DefaultHttpClient(connectionManager, defaultParameters); - } - public InterfaceContract getBindingInterfaceContract() { //return referenceContract; return reference.getInterfaceContract(); @@ -102,7 +73,9 @@ public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider } public void start() { - this.httpClient = createHttpClient(); + // Create an HTTP client + HttpClientFactory clientFactory = new HttpClientFactory(); + httpClient = clientFactory.createHttpClient(); } public void stop() { |