Author: jochen Date: Sat Jan 7 19:21:46 2006 New Revision: 366978 URL: http://svn.apache.org/viewcvs?rev=366978&view=rev Log: Eliminated use of deprecated methods from commons-httpclient 2.0.
Modified: webservices/xmlrpc/branches/b20050512_streaming/.settings/org.eclipse.jdt.core.prefs webservices/xmlrpc/branches/b20050512_streaming/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java webservices/xmlrpc/branches/b20050512_streaming/src/test/java/org/apache/xmlrpc/test/BaseTest.java Modified: webservices/xmlrpc/branches/b20050512_streaming/.settings/org.eclipse.jdt.core.prefs URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/branches/b20050512_streaming/.settings/org.eclipse.jdt.core.prefs?rev=366978&r1=366977&r2=366978&view=diff ============================================================================== --- webservices/xmlrpc/branches/b20050512_streaming/.settings/org.eclipse.jdt.core.prefs (original) +++ webservices/xmlrpc/branches/b20050512_streaming/.settings/org.eclipse.jdt.core.prefs Sat Jan 7 19:21:46 2006 @@ -1,4 +1,4 @@ -#Wed Aug 24 21:47:52 CEST 2005 +#Sun Jan 08 04:20:38 CET 2006 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning @@ -39,7 +39,7 @@ org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning Modified: webservices/xmlrpc/branches/b20050512_streaming/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/branches/b20050512_streaming/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java?rev=366978&r1=366977&r2=366978&view=diff ============================================================================== --- webservices/xmlrpc/branches/b20050512_streaming/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java (original) +++ webservices/xmlrpc/branches/b20050512_streaming/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java Sat Jan 7 19:21:46 2006 @@ -15,7 +15,6 @@ */ package org.apache.xmlrpc.client; -import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -25,9 +24,12 @@ import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.UsernamePasswordCredentials; +import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig; @@ -43,7 +45,7 @@ final PostMethod method; CommonsConnection(XmlRpcHttpClientConfig pConfig) { method = new PostMethod(pConfig.getServerURL().toString()); - method.setHttp11(true); + method.getParams().setVersion(HttpVersion.HTTP_1_1); } } @@ -91,9 +93,6 @@ } protected void setContentLength(Object pConnection, int pLength) { - CommonsConnection conn = (CommonsConnection) pConnection; - PostMethod method = conn.method; - method.setRequestContentLength(pLength); } protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, Object pConnection, byte[] pContents) @@ -101,10 +100,10 @@ XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pConfig; CommonsConnection conn = (CommonsConnection) pConnection; PostMethod method = conn.method; - method.setRequestBody(new ByteArrayInputStream(pContents)); + method.setRequestEntity(new ByteArrayRequestEntity(pContents, "text/xml")); HostConfiguration hostConfig; try { - URI hostURI = new URI(config.getServerURL().toString()); + URI hostURI = new URI(config.getServerURL().toString(), false); hostConfig = new HostConfiguration(); hostConfig.setHost(hostURI); } catch (URIException e) { @@ -124,7 +123,8 @@ String userName = pConfig.getBasicUserName(); if (userName != null) { Credentials creds = new UsernamePasswordCredentials(userName, pConfig.getBasicPassword()); - ((CommonsConnection) pConnection).client.getState().setCredentials(null, null, creds); + AuthScope scope = new AuthScope(null, AuthScope.ANY_PORT, null, AuthScope.ANY_SCHEME); + ((CommonsConnection) pConnection).client.getState().setCredentials(scope, creds); } } } Modified: webservices/xmlrpc/branches/b20050512_streaming/src/test/java/org/apache/xmlrpc/test/BaseTest.java URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/branches/b20050512_streaming/src/test/java/org/apache/xmlrpc/test/BaseTest.java?rev=366978&r1=366977&r2=366978&view=diff ============================================================================== --- webservices/xmlrpc/branches/b20050512_streaming/src/test/java/org/apache/xmlrpc/test/BaseTest.java (original) +++ webservices/xmlrpc/branches/b20050512_streaming/src/test/java/org/apache/xmlrpc/test/BaseTest.java Sat Jan 7 19:21:46 2006 @@ -17,13 +17,10 @@ import java.io.IOException; import java.io.StringReader; -import java.text.DecimalFormat; -import java.text.NumberFormat; import java.util.Arrays; import java.util.Calendar; import java.util.HashMap; import java.util.Iterator; -import java.util.Locale; import java.util.Map; import java.util.TimeZone;