You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by jo...@apache.org on 2006/03/25 23:59:49 UTC

svn commit: r388849 - in /webservices/xmlrpc/trunk: .settings/ client/src/main/java/org/apache/xmlrpc/client/ common/src/main/java/org/apache/xmlrpc/common/ server/src/main/java/org/apache/xmlrpc/metadata/ server/src/main/java/org/apache/xmlrpc/server/...

Author: jochen
Date: Sat Mar 25 14:59:47 2006
New Revision: 388849

URL: http://svn.apache.org/viewcvs?rev=388849&view=rev
Log:
Simplified the client code and made streaming possible with the Commons HttpClient.

Removed:
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/ClientStreamConnection.java
Modified:
    webservices/xmlrpc/trunk/.settings/org.eclipse.jdt.core.prefs
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcClientWorker.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLiteHttpTransport.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransport.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransportFactory.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcStreamTransport.java
    webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcSunHttpTransport.java
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/LocalStreamConnection.java
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcStreamRequestProcessor.java
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorker.java
    webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorkerFactory.java
    webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/metadata/Util.java
    webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcLocalStreamServer.java
    webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcStreamServer.java
    webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/WebServer.java

Modified: webservices/xmlrpc/trunk/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/.settings/org.eclipse.jdt.core.prefs?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/.settings/org.eclipse.jdt.core.prefs (original)
+++ webservices/xmlrpc/trunk/.settings/org.eclipse.jdt.core.prefs Sat Mar 25 14:59:47 2006
@@ -1,12 +1,13 @@
-#Fri Mar 03 08:22:27 CET 2006
+#Mon Mar 13 22:37:26 CET 2006
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.4
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 org.eclipse.jdt.core.compiler.problem.autoboxing=warning
@@ -25,9 +26,20 @@
 org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
 org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
 org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
@@ -59,4 +71,4 @@
 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.4

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcClientWorker.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcClientWorker.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcClientWorker.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcClientWorker.java Sat Mar 25 14:59:47 2006
@@ -65,11 +65,9 @@
 	/** Performs an synchronous request.
 	 * @param pRequest The request being performed.
 	 * @param pCallback The callback being invoked, when the request is finished.
-	 * @throws XmlRpcException Performing the request failed.
 	 */
 	public void execute(final XmlRpcRequest pRequest,
-						final AsyncCallback pCallback)
-			throws XmlRpcException {
+						final AsyncCallback pCallback) {
 		Runnable runnable = new Runnable(){
 			public void run(){
 				Object result = null;

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcCommonsTransport.java Sat Mar 25 14:59:47 2006
@@ -15,59 +15,60 @@
  */
 package org.apache.xmlrpc.client;
 
+import java.io.BufferedOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
 import org.apache.commons.httpclient.Credentials;
 import org.apache.commons.httpclient.Header;
-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.commons.httpclient.methods.RequestEntity;
 import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.common.ClientStreamConnection;
+import org.apache.xmlrpc.XmlRpcRequest;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
 import org.apache.xmlrpc.util.HttpUtil;
+import org.apache.xmlrpc.util.XmlRpcIOException;
 
 
 /** An HTTP transport factory, which is based on the Jakarta Commons
  * HTTP Client.
  */
 public class XmlRpcCommonsTransport extends XmlRpcHttpTransport {
-	private class CommonsConnection implements ClientStreamConnection {
-		final HttpClient client = new HttpClient();
-		final PostMethod method;
-		CommonsConnection(XmlRpcHttpClientConfig pConfig) {
-			method = new PostMethod(pConfig.getServerURL().toString());
-			method.getParams().setVersion(HttpVersion.HTTP_1_1);
-		}
-	}
-
-	private String userAgent = super.getUserAgent() + " (Jakarta Commons httpclient Transport)";
+	private final HttpClient client = new HttpClient();
+	private static final String userAgent = USER_AGENT + " (Jakarta Commons httpclient Transport)";
+	private PostMethod method;
+	private int contentLength = -1;
 
 	/** Creates a new instance.
 	 * @param pClient The client, which will be invoking the transport.
 	 */
 	public XmlRpcCommonsTransport(XmlRpcClient pClient) {
-		super(pClient);
+		super(pClient, userAgent);
 	}
 
-	protected String getUserAgent() { return userAgent; }
+	protected void setContentLength(int pLength) {
+		contentLength = pLength;
+	}
 
-	protected void setRequestHeader(ClientStreamConnection pConnection, String pHeader, String pValue) {
-		PostMethod method = ((CommonsConnection) pConnection).method;
+	public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
+		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
+		method = new PostMethod(config.getServerURL().toString());
+		method.getParams().setVersion(HttpVersion.HTTP_1_1);
+		return super.sendRequest(pRequest);
+	}
+
+	protected void setRequestHeader(String pHeader, String pValue) {
 		method.setRequestHeader(new Header(pHeader, pValue));
 	}
 
-	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) {
-		Header h = ((CommonsConnection) pConnection).method.getResponseHeader( "Content-Encoding" );
+	protected boolean isResponseGzipCompressed() {
+		Header h = method.getResponseHeader( "Content-Encoding" );
 		if (h == null) {
 			return false;
 		} else {
@@ -75,43 +76,8 @@
 		}
 	}
 
-	protected ClientStreamConnection newConnection(XmlRpcStreamRequestConfig pConfig) throws XmlRpcClientException {
-		return new CommonsConnection((XmlRpcHttpClientConfig) pConfig);
-	}
-
-	protected void closeConnection(ClientStreamConnection pConnection) throws XmlRpcClientException {
-		((CommonsConnection) pConnection).method.releaseConnection();
-	}
-
-	protected OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcClientException {
-		throw new IllegalStateException("Not implemented");
-	}
-
-	protected boolean isUsingByteArrayOutput(XmlRpcStreamRequestConfig pConfig) { return true; }
-
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcException {
-		throw new IllegalStateException("Not implemented");
-	}
-
-	protected void setContentLength(ClientStreamConnection pConnection, int pLength) {
-	}
-
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection, byte[] pContents)
-			throws XmlRpcException {
-		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pConfig;
-		CommonsConnection conn = (CommonsConnection) pConnection;
-		PostMethod method = conn.method;
-		method.setRequestEntity(new ByteArrayRequestEntity(pContents, "text/xml"));
-		HostConfiguration hostConfig;
+	protected InputStream getInputStream() throws XmlRpcException {
 		try {
-			URI hostURI = new URI(config.getServerURL().toString(), false);
-			hostConfig = new HostConfiguration();
-			hostConfig.setHost(hostURI);
-		} catch (URIException e) {
-			throw new XmlRpcClientException("Failed to parse URL: " + config.getServerURL().toString(), e);
-		}
-		try {
-			conn.client.executeMethod(hostConfig, method);
 			return method.getResponseBodyAsStream();
 		} catch (HttpException e) {
 			throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
@@ -120,12 +86,60 @@
 		}
 	}
 
-	protected void setCredentials(XmlRpcHttpClientConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcClientException {
+	protected void setCredentials(XmlRpcHttpClientConfig pConfig) throws XmlRpcClientException {
 		String userName = pConfig.getBasicUserName();
 		if (userName != null) {
 			Credentials creds = new UsernamePasswordCredentials(userName, pConfig.getBasicPassword());
 			AuthScope scope = new AuthScope(null, AuthScope.ANY_PORT, null, AuthScope.ANY_SCHEME);
-			((CommonsConnection) pConnection).client.getState().setCredentials(scope, creds);
+			client.getState().setCredentials(scope, creds);
+		}
+	}
+
+	protected void close() throws XmlRpcClientException {
+		method.releaseConnection();
+	}
+
+	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig) {
+		Header h = method.getResponseHeader( "Content-Encoding" );
+		if (h == null) {
+			return false;
+		} else {
+			return HttpUtil.isUsingGzipEncoding(h.getValue());
+		}
+	}
+
+	protected void writeRequest(final RequestWriter pWriter) throws XmlRpcException {
+		method.setRequestEntity(new RequestEntity(){
+			public boolean isRepeatable() { return false; }
+			public void writeRequest(OutputStream pOut) throws IOException {
+				/* Make sure, that the socket is not closed by replacing it with our
+				 * own BufferedOutputStream.
+				 */
+				BufferedOutputStream bos = new BufferedOutputStream(pOut){
+					public void close() throws IOException {
+						flush();
+					}
+				};
+				try {
+					pWriter.write(bos);
+				} catch (XmlRpcException e) {
+					throw new XmlRpcIOException(e);
+				}
+			}
+			public long getContentLength() { return contentLength; }
+			public String getContentType() { return "text/xml"; }
+		});
+		try {
+			client.executeMethod(method);
+		} catch (XmlRpcIOException e) {
+			Throwable t = e.getLinkedException();
+			if (t instanceof XmlRpcException) {
+				throw (XmlRpcException) t;
+			} else {
+				throw new XmlRpcException("Unexpected exception: " + t.getMessage(), t);
+			}
+		} catch (IOException e) {
+			throw new XmlRpcException("I/O error while communicating with HTTP server: " + e.getMessage(), e);
 		}
 	}
 }

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcHttpTransport.java Sat Mar 25 14:59:47 2006
@@ -1,11 +1,12 @@
 package org.apache.xmlrpc.client;
 
-import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 
 import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.common.ClientStreamConnection;
-import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
+import org.apache.xmlrpc.XmlRpcRequest;
 import org.apache.xmlrpc.util.HttpUtil;
 
 
@@ -14,17 +15,46 @@
  * or {@link org.apache.xmlrpc.client.XmlRpcCommonsTransport}.
  */
 public abstract class XmlRpcHttpTransport extends XmlRpcStreamTransport {
+	protected class ByteArrayRequestWriter extends RequestWriter {
+		private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+		protected ByteArrayRequestWriter(XmlRpcRequest pRequest)
+				throws XmlRpcException {
+			super(pRequest);
+			super.writeUncompressed(baos);
+		}
+
+		protected void writeUncompressed(OutputStream pStream) throws XmlRpcException {
+			try {
+				baos.writeTo(pStream);
+				pStream.close();
+				pStream = null;
+			} catch (IOException e) {
+				throw new XmlRpcException("Failed to write request: " + e.getMessage(), e);
+			} finally {
+				if (pStream != null) { try { pStream.close(); } catch (Throwable ignore) {} }
+			}
+		}
+
+		protected int getContentLength() { return baos.size(); }
+	}
+
+	private String userAgent;
+
 	/** The user agent string.
 	 */
 	public static final String USER_AGENT = "Apache XML RPC 3.0";
 
-	protected XmlRpcHttpTransport(XmlRpcClient pClient) {
+	protected XmlRpcHttpTransport(XmlRpcClient pClient, String pUserAgent) {
 		super(pClient);
+		userAgent = pUserAgent;
 	}
 
-	protected abstract void setRequestHeader(ClientStreamConnection pConnection, String pHeader, String pValue);
+	protected String getUserAgent() { return userAgent; }
+
+	protected abstract void setRequestHeader(String pHeader, String pValue);
 
-	protected void setCredentials(XmlRpcHttpClientConfig pConfig, ClientStreamConnection pConnection)
+	protected void setCredentials(XmlRpcHttpClientConfig pConfig)
 			throws XmlRpcClientException {
 		String auth;
 		try {
@@ -35,45 +65,50 @@
 			throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
 		}
 		if (auth != null) {
-			setRequestHeader(pConnection, "Authorization", "Basic " + auth);
+			setRequestHeader("Authorization", "Basic " + auth);
 		}
 	}
 
-	protected void setContentLength(ClientStreamConnection pConnection, int pLength) {
-		setRequestHeader(pConnection, "Content-Length", Integer.toString(pLength));
+	protected void setContentLength(int pLength) {
+		setRequestHeader("Content-Length", Integer.toString(pLength));
 	}
 
-	protected InputStream getInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection, byte[] pContent) throws XmlRpcException {
-		if (pContent != null) {
-			setContentLength(pConnection, pContent.length);
-		}
-		return super.getInputStream(pConfig, pConnection, pContent);
-	}
-
-	protected void setCompressionHeaders(XmlRpcHttpClientConfig pConfig, ClientStreamConnection pConnection) {
+	protected void setCompressionHeaders(XmlRpcHttpClientConfig pConfig) {
 		if (pConfig.isGzipCompressing()) {
-			setRequestHeader(pConnection, "Content-Encoding", "gzip");
+			setRequestHeader("Content-Encoding", "gzip");
 		}
 		if (pConfig.isGzipRequesting()) {
-			setRequestHeader(pConnection, "Accept-Encoding", "gzip");
+			setRequestHeader("Accept-Encoding", "gzip");
 		}
 	}
 
-	protected String getUserAgent() { return USER_AGENT; }
-
-	protected void initConnection(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcClientException {
-		super.initConnection(pConfig, pConnection);
-		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pConfig;
-		setRequestHeader(pConnection, "Content-Type", "text/xml");
-		setRequestHeader(pConnection, "User-Agent", getUserAgent());
-		setCredentials(config, pConnection);
-		setCompressionHeaders(config, pConnection);
+	protected void initHttpHeaders(XmlRpcRequest pRequest) throws XmlRpcClientException {
+		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
+		setRequestHeader("Content-Type", "text/xml");
+		setRequestHeader("User-Agent", getUserAgent());
+		setCredentials(config);
+		setCompressionHeaders(config);
 	}
 
-	protected abstract boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection);
-
-	protected boolean isUsingByteArrayOutput(XmlRpcStreamRequestConfig pConfig) {
+	public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
+		initHttpHeaders(pRequest);
+		return super.sendRequest(pRequest);
+	}
+	
+	protected boolean isUsingByteArrayOutput(XmlRpcHttpClientConfig pConfig) {
 		return !pConfig.isEnabledForExtensions()
-			|| !((XmlRpcHttpClientConfig) pConfig).isContentLengthOptional();
+			|| !pConfig.isContentLengthOptional();
+	}
+
+	protected RequestWriter newRequestWriter(XmlRpcRequest pRequest)
+			throws XmlRpcException {
+		final XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
+		if (isUsingByteArrayOutput(config)) {
+			ByteArrayRequestWriter result = new ByteArrayRequestWriter(pRequest);
+			setContentLength(result.getContentLength());
+			return result;
+		} else {
+			return super.newRequestWriter(pRequest);
+		}
 	}
 }

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLiteHttpTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLiteHttpTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLiteHttpTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLiteHttpTransport.java Sat Mar 25 14:59:47 2006
@@ -32,7 +32,7 @@
 import java.util.StringTokenizer;
 
 import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.common.ClientStreamConnection;
+import org.apache.xmlrpc.XmlRpcRequest;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
 import org.apache.xmlrpc.util.HttpUtil;
 import org.apache.xmlrpc.util.LimitedInputStream;
@@ -41,49 +41,48 @@
 /** A "light" HTTP transport implementation.
  */
 public class XmlRpcLiteHttpTransport extends XmlRpcHttpTransport {
-	private class Connection implements ClientStreamConnection {
-		private final String hostname;
-	    private final String host;
-		private int port;
-		private final String uri;
-	    private Socket socket;
-		private OutputStream output;
-	    private InputStream input;
-		private final Map headers = new HashMap();
-		Connection(URL pURL) {
-	        hostname = pURL.getHost();
-	        int p = pURL.getPort();
-			port = p < 1 ? 80 : p;
-			String u = pURL.getFile();
-			uri = (u == null  ||  "".equals(u)) ? "/" : u;
-			host = port == 80 ? hostname : hostname + ":" + port;
-			headers.put("Host", host);
-		}
-	}
-
-	private final String userAgent = super.getUserAgent() + " (Lite HTTP Transport)";
+	private static final String userAgent = USER_AGENT + " (Lite HTTP Transport)";
+	private String hostname;
+	private String host;
+	private int port;
+	private String uri;
+	private Socket socket;
+	private OutputStream output;
+	private InputStream input;
+	private final Map headers = new HashMap();
+	private boolean responseGzipCompressed = false;
+	private XmlRpcHttpClientConfig config;
 
 	/** Creates a new instance.
 	 * @param pClient The client controlling this instance.
 	 */
 	public XmlRpcLiteHttpTransport(XmlRpcClient pClient) {
-		super(pClient);
+		super(pClient, userAgent);
 	}
 
-	protected String getUserAgent() { return userAgent; }
+	public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
+		config = (XmlRpcHttpClientConfig) pRequest.getConfig();
+		URL url = config.getServerURL();
+		hostname = url.getHost();
+        int p = url.getPort();
+		port = p < 1 ? 80 : p;
+		String u = url.getFile();
+		uri = (u == null  ||  "".equals(u)) ? "/" : u;
+		host = port == 80 ? hostname : hostname + ":" + port;
+		headers.put("Host", host);
+		return super.sendRequest(pRequest);
+	}
 
-	protected void setRequestHeader(ClientStreamConnection pConnection, String pHeader,
-									String pValue) {
-		Connection conn = (Connection) pConnection;
-		Object value = conn.headers.get(pHeader);
+	protected void setRequestHeader(String pHeader, String pValue) {
+		Object value = headers.get(pHeader);
 		if (value == null) {
-			conn.headers.put(pHeader, pValue);
+			headers.put(pHeader, pValue);
 		} else {
 			List list;
 			if (value instanceof String) {
 				list = new ArrayList();
 				list.add(value);
-				conn.headers.put(pHeader, list);
+				headers.put(pHeader, list);
 			} else {
 				list = (List) value;
 			}
@@ -91,40 +90,27 @@
 		}
 	}
 
-	protected boolean isResponseGzipCompressed(
-			XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	protected ClientStreamConnection newConnection(XmlRpcStreamRequestConfig pConfig)
-			throws XmlRpcClientException {
-		return new Connection(((XmlRpcHttpClientConfig) pConfig).getServerURL());
-	}
-
-	protected void closeConnection(ClientStreamConnection pConnection)
-			throws XmlRpcClientException {
-		Connection conn = (Connection) pConnection;
+	protected void close() throws XmlRpcClientException {
 		IOException e = null;
-		if (conn.input != null) {
+		if (input != null) {
 			try {
-				conn.input.close();
+				input.close();
 			} catch (IOException ex) {
 				e = ex;
 			}
 		}
-		if (conn.output != null) {
+		if (output != null) {
 			try {
-				conn.output.close();
+				output.close();
 			} catch (IOException ex) {
 				if (e != null) {
 					e = ex;
 				}
 			}
 		}
-		if (conn.socket != null) {
+		if (socket != null) {
 			try {
-				conn.socket.close();
+				socket.close();
 			} catch (IOException ex) {
 				if (e != null) {
 					e = ex;
@@ -136,40 +122,43 @@
 		}
 	}
 
-	protected OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig,
-										   ClientStreamConnection pConnection) throws XmlRpcClientException {
-		final Connection conn = (Connection) pConnection;
-		final int retries = 3;
-        final int delayMillis = 100;
-        
-		for (int tries = 0;  ;  tries++) {
-			try {
-				conn.socket = new Socket(conn.hostname, conn.port);
-				conn.output = new BufferedOutputStream(conn.socket.getOutputStream()){
-					/** Closing the output stream would close the whole socket, which we don't want,
-					 * because the don't want until the request is processed completely.
-					 * A close will later occur within
-					 * {@link XmlRpcLiteHttpTransport#closeConnection(Object)}.
-					 */
-					public void close() throws IOException {
-						flush();
-						conn.socket.shutdownOutput();
+	private OutputStream getOutputStream() throws XmlRpcException {
+		try {
+			final int retries = 3;
+	        final int delayMillis = 100;
+	
+			for (int tries = 0;  ;  tries++) {
+				try {
+					socket = new Socket(hostname, port);
+					output = new BufferedOutputStream(socket.getOutputStream()){
+						/** Closing the output stream would close the whole socket, which we don't want,
+						 * because the don't want until the request is processed completely.
+						 * A close will later occur within
+						 * {@link XmlRpcLiteHttpTransport#close()}.
+						 */
+						public void close() throws IOException {
+							flush();
+							socket.shutdownOutput();
+						}
+					};
+					break;
+				} catch (ConnectException e) {
+					if (tries >= retries) {
+						throw new XmlRpcException("Failed to connect to "
+								+ hostname + ":" + port + ": " + e.getMessage(), e);
+					} else {
+	                    try {
+	                        Thread.sleep(delayMillis);
+	                    } catch (InterruptedException ignore) {
+	                    }
 					}
-				};
-				sendRequestHeaders(conn, conn.output);
-				return conn.output;
-			} catch (ConnectException e) {
-				if (tries >= retries) {
-					throw new XmlRpcClientException("Failed to connect to " + conn.host + ": " + e.getMessage(), e);
-				} else {
-                    try {
-                        Thread.sleep(delayMillis);
-                    } catch (InterruptedException ignore) {
-                    }
 				}
-			} catch (IOException e) {
-				throw new XmlRpcClientException("Failed to connect to " + conn.host + ": " + e.getMessage(), e);
 			}
+			sendRequestHeaders(output);
+			return output;
+		} catch (IOException e) {
+			throw new XmlRpcException("Failed to open connection to "
+					+ hostname + ":" + port + ": " + e.getMessage(), e);
 		}
 	}
 
@@ -181,10 +170,9 @@
 		pOut.write(toHTTPBytes(pKey + ": " + pValue + "\r\n"));
 	}
 
-	private void sendRequestHeaders(Connection pConnection,
-									OutputStream pOut) throws IOException {
-		pOut.write(("POST " + pConnection.uri + " HTTP/1.0\r\n").getBytes("US-ASCII"));
-		for (Iterator iter = pConnection.headers.entrySet().iterator();  iter.hasNext();  ) {
+	private void sendRequestHeaders(OutputStream pOut) throws IOException {
+		pOut.write(("POST " + uri + " HTTP/1.0\r\n").getBytes("US-ASCII"));
+		for (Iterator iter = headers.entrySet().iterator();  iter.hasNext();  ) {
 			Map.Entry entry = (Map.Entry) iter.next();
 			String key = (String) entry.getKey();
 			Object value = entry.getValue();
@@ -200,58 +188,51 @@
 		pOut.write(toHTTPBytes("\r\n"));
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
-										 ClientStreamConnection pConnection,
-										 byte[] pContent) throws XmlRpcException {
-		try {
-			Connection conn = (Connection) pConnection;
-			conn.socket = new Socket(conn.hostname, conn.port);
-			conn.output = new BufferedOutputStream(conn.socket.getOutputStream());
-			sendRequestHeaders(conn, conn.output);
-			conn.output.write(pContent);
-			conn.output.flush();
-		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to send request to sender: " + e.getMessage(), e);
-		}
-		return newInputStream(pConfig, pConnection);
+	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig) {
+		return responseGzipCompressed;
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
-										 ClientStreamConnection pConnection) throws XmlRpcException {
-		Connection conn = (Connection) pConnection;
+	protected InputStream getInputStream() throws XmlRpcException {
 		final byte[] buffer = new byte[2048];
 		try {
-			conn.input = new BufferedInputStream(conn.socket.getInputStream());
+			input = new BufferedInputStream(socket.getInputStream());
 			// start reading  server response headers
-			String line = HttpUtil.readLine(conn.input, buffer);
+			String line = HttpUtil.readLine(input, buffer);
 			StringTokenizer tokens = new StringTokenizer(line);
 			tokens.nextToken(); // Skip HTTP version
 			String statusCode = tokens.nextToken();
 			String statusMsg = tokens.nextToken("\n\r");
-			if (! "200".equals(statusCode)) {
+			if (!"200".equals(statusCode)) {
 				throw new IOException("Unexpected Response from Server: "
 									  + statusMsg);
 			}
 			int contentLength = -1;
 			for (;;) {
-				line = HttpUtil.readLine(conn.input, buffer);
+				line = HttpUtil.readLine(input, buffer);
 				if (line == null  ||  "".equals(line)) {
 					break;
 				}
 				line = line.toLowerCase();
 				if (line.startsWith("content-length:")) {
 					contentLength = Integer.parseInt(line.substring("content-length:".length()).trim());
+				} else if (line.startsWith("content-encoding:")) {
+					responseGzipCompressed = HttpUtil.isUsingGzipEncoding(line.substring("content-encoding:".length()));
 				}
 			}
 			InputStream result;
 			if (contentLength == -1) {
-				result = conn.input;
+				result = input;
 			} else {
-				result = new LimitedInputStream(conn.input, contentLength);
+				result = new LimitedInputStream(input, contentLength);
 			}
 			return result;
 		} catch (IOException e) {
 			throw new XmlRpcClientException("Failed to read server response: " + e.getMessage(), e);
 		}
+	}
+
+	protected void writeRequest(RequestWriter pWriter) throws XmlRpcException {
+		OutputStream ostream = getOutputStream();
+		pWriter.write(ostream);
 	}
 }

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransport.java Sat Mar 25 14:59:47 2006
@@ -17,12 +17,9 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 
 import org.apache.xmlrpc.XmlRpcException;
-import org.apache.xmlrpc.common.ClientStreamConnection;
 import org.apache.xmlrpc.common.LocalStreamConnection;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestProcessor;
@@ -36,10 +33,11 @@
  */
 public class XmlRpcLocalStreamTransport extends XmlRpcStreamTransport {
 	private final XmlRpcStreamRequestProcessor localServer;
+	private LocalStreamConnection conn;
 	
 	/** Creates a new instance.
 	 * @param pClient The client, which is controlling the transport.
-	 * @param pServer An instance of {@link XmlRpcLocalStreamServer}.
+	 * @param pServer An instance of {@link XmlRpcStreamRequestProcessor}.
 	 */
 	public XmlRpcLocalStreamTransport(XmlRpcClient pClient,
 			XmlRpcStreamRequestProcessor pServer) {
@@ -47,41 +45,22 @@
 		localServer = pServer;
 	}
 
-	protected ClientStreamConnection newConnection(XmlRpcStreamRequestConfig pConfig) throws XmlRpcClientException {
-		return new LocalStreamConnection();
-	}
-
-	protected void closeConnection(ClientStreamConnection pConnection) throws XmlRpcClientException {
-		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		final ByteArrayOutputStream ostream = lsc.getOstream();
-		if (ostream != null) {
-			try { ostream.close(); } catch (Throwable ignore) {}
-		}
-	}
-
-	protected OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcClientException {
-		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		ByteArrayOutputStream ostream = new ByteArrayOutputStream();
-		lsc.setOstream(ostream);
-		return ostream;
+	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig) {
+		return pConfig.isGzipRequesting();
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcException {
-		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		try {
-			localServer.execute(pConfig, lsc);
-		} catch (IOException e) {
-			throw new XmlRpcException(e.getMessage(), e);
-		}
-		return new ByteArrayInputStream(lsc.getIstream().toByteArray());
+	protected void close() throws XmlRpcClientException {
 	}
 
-	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) {
-		return pConfig.isGzipRequesting();
+	protected InputStream getInputStream() throws XmlRpcException {
+		localServer.execute(conn.getConfig(), conn);
+		return new ByteArrayInputStream(conn.getResponse().toByteArray());
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection, byte[] pContent) throws XmlRpcException {
-		throw new IllegalStateException("Not implemented");
+	protected void writeRequest(RequestWriter pWriter) throws XmlRpcException {
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();		
+		pWriter.write(baos);
+		XmlRpcStreamRequestConfig config = (XmlRpcStreamRequestConfig) pWriter.getRequest().getConfig();
+		conn = new LocalStreamConnection(config, new ByteArrayInputStream(baos.toByteArray()));
 	}
 }

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransportFactory.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransportFactory.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransportFactory.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcLocalStreamTransportFactory.java Sat Mar 25 14:59:47 2006
@@ -29,7 +29,7 @@
 
 	/** Creates a new instance.
 	 * @param pClient The client controlling the factory.
-	 * @param pServer An instance of {@link XmlRpcLocalStreamServer}.
+	 * @param pServer An instance of {@link XmlRpcStreamRequestProcessor}.
 	 */
 	public XmlRpcLocalStreamTransportFactory(XmlRpcClient pClient,
 			XmlRpcStreamRequestProcessor pServer) {

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcStreamTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcStreamTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcStreamTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcStreamTransport.java Sat Mar 25 14:59:47 2006
@@ -15,19 +15,15 @@
  */
 package org.apache.xmlrpc.client;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
 import org.apache.xmlrpc.XmlRpcException;
 import org.apache.xmlrpc.XmlRpcRequest;
-import org.apache.xmlrpc.common.ClientStreamConnection;
+import org.apache.xmlrpc.common.XmlRpcStreamConfig;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
 import org.apache.xmlrpc.parser.XmlRpcResponseParser;
 import org.apache.xmlrpc.serializer.XmlRpcWriter;
@@ -43,181 +39,122 @@
  * the response,
  */
 public abstract class XmlRpcStreamTransport extends XmlRpcTransportImpl {
-	/** Creates a new instance on behalf of the given client.
-	 */
-	protected XmlRpcStreamTransport(XmlRpcClient pClient) {
-		super(pClient);
-	}
-
-	/** Creates the connection object. The connection object is a
-	 * factory for output and input stream.
-	 */
-	protected abstract ClientStreamConnection newConnection(XmlRpcStreamRequestConfig pConfig) throws XmlRpcClientException;
-
-	/** Closes the connection object.
-	 */
-	protected abstract void closeConnection(ClientStreamConnection pConnection) throws XmlRpcClientException;
-
-	/** Initializes the newly created connection. For example, the HTTP transport
-	 * will use this to set headers.
-	 * @param pConfig The clients configuration.
-	 * @param pConnection The connection being initialized.
-	 * @throws XmlRpcClientException A local error on the client occurred.
-	 */
-	protected void initConnection(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) throws XmlRpcClientException {
-	}
+	protected class RequestWriter {
+		private final XmlRpcRequest request;
 
-	/** Creates a new output stream, to which the request may be written.
-	 * @param pConfig Client configuration.
-	 * @param pConnection Connection being used to send request data.
-	 * @return Opened output stream.
-	 * @throws XmlRpcClientException An error occurred on the client.
-	 */
-	protected abstract OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcClientException;
+		protected RequestWriter(XmlRpcRequest pRequest) {
+			request = pRequest;
+		}
 
-	/** Closes the opened output stream, indicating that no more data is being
-	 * sent.
-	 * @param pStream The stream being closed.
-	 * @throws XmlRpcClientException An error occurred on the client.
-	 */
-	protected void closeOutputStream(OutputStream pStream) throws XmlRpcClientException {
-		try {
-			pStream.close();
-		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to close output stream.", e);
+		protected XmlRpcRequest getRequest() {
+			return request;
+		}
+
+		/** Writes the requests XML data to the given output stream,
+		 * possibly compressing it. Ensures, that the output stream
+		 * is being closed.
+		 */
+		protected void write(OutputStream pStream) throws XmlRpcException {
+			XmlRpcStreamRequestConfig config = (XmlRpcStreamRequestConfig) request.getConfig();
+			if (isCompressingRequest(config)) {
+				try {
+					GZIPOutputStream gStream = new GZIPOutputStream(pStream);
+					writeUncompressed(gStream);
+					pStream.close();
+					pStream = null;
+				} catch (IOException e) {
+					throw new XmlRpcException("Failed to write request: " + e.getMessage(), e);
+				} finally {
+					if (pStream != null) { try { pStream.close(); } catch (Throwable ignore) {} }
+				}
+			} else {
+				writeUncompressed(pStream);
+			}
 		}
-	}
 
-	protected OutputStream getOutputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcClientException {
-		OutputStream result = newOutputStream(pConfig, pConnection);
-		if (pConfig.isGzipCompressing()) {
+		/** Writes the requests uncompressed XML data to the given
+		 * output stream. Ensures, that the output stream is being
+		 * closed.
+		 */
+		protected void writeUncompressed(OutputStream pStream)
+				throws XmlRpcException {
+			final XmlRpcStreamConfig config = (XmlRpcStreamConfig) request.getConfig();
 			try {
-				result = new GZIPOutputStream(result);
+				ContentHandler h = getClient().getXmlWriterFactory().getXmlWriter(config, pStream);
+				XmlRpcWriter xw = new XmlRpcWriter(config, h, getClient().getTypeFactory());
+				xw.write(request);
+				pStream.close();
+				pStream = null;
+			} catch (SAXException e) {
+				Exception ex = e.getException();
+				if (ex != null  &&  ex instanceof XmlRpcException) {
+					throw (XmlRpcException) ex;
+				} else {
+					throw new XmlRpcClientException("Failed to send request: " + e.getMessage(), e);
+				}
 			} catch (IOException e) {
-				throw new XmlRpcClientException("Failed to attach gzip encoding to output stream", e);
+				throw new XmlRpcException("Failed to write request: " + e.getMessage(), e);
+			} finally {
+				if (pStream != null) { try { pStream.close(); } catch (Throwable ignore) {} }
 			}
 		}
-		return result;
 	}
 
-	/** Creates a new input stream for reading the response.
-	 * @param pConfig The clients configuration.
-	 * @param pConnection The connection object.
-	 * @return Opened input stream for reading data.
-	 * @throws XmlRpcException Creating the input stream failed.
+	protected RequestWriter newRequestWriter(XmlRpcRequest pRequest)
+			throws XmlRpcException {
+		return new RequestWriter(pRequest);
+	}
+	
+	/** Creates a new instance on behalf of the given client.
 	 */
-	protected abstract InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcException;
+	protected XmlRpcStreamTransport(XmlRpcClient pClient) {
+		super(pClient);
+	}
 
-	/** Creates a new input stream for reading the response.
-	 * @param pConfig The clients configuration.
-	 * @param pConnection The connection object.
-	 * @param pContent A byte array with the response.
-	 * @return Opened input stream for reading data.
-	 * @throws XmlRpcException Creating the input stream failed.
-	 */
-	protected abstract InputStream newInputStream(XmlRpcStreamRequestConfig pConfig,
-												  ClientStreamConnection pConnection,
-												  byte[] pContent)
-			throws XmlRpcException;
-
-	/** Closes the opened input stream, indicating that no more data is being
-	 * read.
-	 * @param pStream The stream being closed.
-	 * @throws XmlRpcClientException An error occurred on the client.
+	/** Closes the connection and ensures, that all resources are being
+	 * released.
 	 */
-	protected void closeInputStream(InputStream pStream) throws XmlRpcClientException {
-		try {
-			pStream.close();
-		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to close output stream.", e);
-		}
-	}
+	protected abstract void close() throws XmlRpcClientException;
 
 	/** Returns, whether the response is gzip compressed.
 	 * @param pConfig The clients configuration.
-	 * @param pConnection The connection object.
 	 * @return Whether the response stream is gzip compressed.
 	 */
-	protected abstract boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection);
+	protected abstract boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig);
 
-	protected InputStream getInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection,
-										 byte[] pContent)
-			throws XmlRpcException {
-		InputStream istream;
-		if (pContent == null) {
-			istream = newInputStream(pConfig, pConnection);
-		} else {
-			istream = newInputStream(pConfig, pConnection, pContent);
-		}
-		if (isResponseGzipCompressed(pConfig, pConnection)) {
-			try {
-				istream = new GZIPInputStream(istream);
-			} catch (IOException e) {
-				throw new XmlRpcClientException("Failed to attach gzip decompression to the response stream", e);
-			}
-		}
-		return istream;
-	}
+	/** Invokes the request writer.
+	 */
+	protected abstract void writeRequest(RequestWriter pWriter) throws XmlRpcException;
 
-	/** If this method returns true, then the method
-	 * {@link #newInputStream(XmlRpcStreamRequestConfig, Object, byte[])}
-	 * will be invoked to create the response. Otherwise, the methods
-	 * {@link #getOutputStream(XmlRpcStreamRequestConfig, Object)}, and
-	 * {@link #newInputStream(XmlRpcStreamRequestConfig, Object)} will
-	 * be used.
-	 * @return Whether conversion into a byte array is required to create
-	 * the response.
+	/** Returns the input stream, from which the response is
+	 * being read.
 	 */
-	protected boolean isUsingByteArrayOutput(XmlRpcStreamRequestConfig pConfig) {
-		return false;
+	protected abstract InputStream getInputStream() throws XmlRpcException;
+
+	protected boolean isCompressingRequest(XmlRpcStreamRequestConfig pConfig) {
+		return pConfig.isEnabledForExtensions()
+			&& pConfig.isGzipCompressing();
 	}
 
 	public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
 		XmlRpcStreamRequestConfig config = (XmlRpcStreamRequestConfig) pRequest.getConfig();
-		ClientStreamConnection connection = newConnection(config);
+		boolean closed = false;
 		try {
-			initConnection(config, connection);
-			OutputStream ostream;
-			ByteArrayOutputStream baos;
-			if (isUsingByteArrayOutput(config)) {
-				baos = new ByteArrayOutputStream();
-				if (config.isGzipCompressing()) {
-					try {
-						ostream = new GZIPOutputStream(baos);
-					} catch (IOException e) {
-						throw new XmlRpcClientException("Failed to create GZIPOutputStream: " + e.getMessage(), e);
-					}
-				} else {
-					ostream = baos;
-				}
-			} else {
-				baos = null;
-				ostream = getOutputStream(config, connection);
-			}
-			try {
-				writeRequest(config, ostream, pRequest);
-				closeOutputStream(ostream);
-				ostream = null;
-			} finally {
-				if (ostream != null) { try { closeOutputStream(ostream); } catch (Throwable ignore) {} }
-			}
-			InputStream istream = getInputStream(config, connection, baos == null ? null : baos.toByteArray());
-			Object result;
-			try {
-				result = readResponse(config, istream);
-				closeInputStream(istream);
-				istream = null;
-			} finally {
-				if (istream != null) { try { closeInputStream(istream); } catch (Throwable ignore) {} }
+			RequestWriter writer = newRequestWriter(pRequest);
+			writeRequest(writer);
+			InputStream istream = getInputStream();
+			if (isResponseGzipCompressed(config)) {
+				istream = new GZIPInputStream(istream);
 			}
-			closeConnection(connection);
-			connection = null;
+			Object result = readResponse(config, istream);
+			closed = true;
+			close();
 			return result;
+		} catch (IOException e) {
+			throw new XmlRpcException("Failed to read servers response: "
+					+ e.getMessage(), e);
 		} finally {
-			if (connection != null) { try { closeConnection(connection); } catch (Throwable ignore) {} }
+			if (!closed) { try { close(); } catch (Throwable ignore) {} }
 		}
 	}
 
@@ -242,22 +179,6 @@
 			return xp.getResult();
 		} else {
 			throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
-		}
-	}
-
-	protected void writeRequest(XmlRpcStreamRequestConfig pConfig, OutputStream pStream, XmlRpcRequest pRequest)
-			throws XmlRpcException {
-		ContentHandler h = getClient().getXmlWriterFactory().getXmlWriter(pConfig, pStream);
-		XmlRpcWriter xw = new XmlRpcWriter(pConfig, h, getClient().getTypeFactory());
-		try {
-			xw.write(pRequest);
-		} catch (SAXException e) {
-			Exception ex = e.getException();
-			if (ex != null  &&  ex instanceof XmlRpcException) {
-				throw (XmlRpcException) ex;
-			} else {
-				throw new XmlRpcClientException("Failed to send request: " + e.getMessage(), e);
-			}
 		}
 	}
 }

Modified: webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcSunHttpTransport.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcSunHttpTransport.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcSunHttpTransport.java (original)
+++ webservices/xmlrpc/trunk/client/src/main/java/org/apache/xmlrpc/client/XmlRpcSunHttpTransport.java Sat Mar 25 14:59:47 2006
@@ -6,7 +6,8 @@
 import java.net.HttpURLConnection;
 import java.net.URLConnection;
 
-import org.apache.xmlrpc.common.ClientStreamConnection;
+import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.XmlRpcRequest;
 import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig;
 import org.apache.xmlrpc.util.HttpUtil;
 
@@ -15,83 +16,58 @@
  * {@link java.net.HttpURLConnection} class.
  */
 public class XmlRpcSunHttpTransport extends XmlRpcHttpTransport {
-	private static class SunClientConnection implements ClientStreamConnection {
-		final URLConnection conn;
-		SunClientConnection(URLConnection pConn) {
-			conn = pConn;
-		}
-	}
-
-	private final String userAgent = super.getUserAgent() + " (Sun HTTP Transport)";
+	private static final String userAgent = USER_AGENT + " (Sun HTTP Transport)";
+	private URLConnection conn;
 
 	/** Creates a new instance.
 	 * @param pClient The client controlling this instance.
 	 */
 	public XmlRpcSunHttpTransport(XmlRpcClient pClient) {
-		super(pClient);
+		super(pClient, userAgent);
 	}
 
-	protected String getUserAgent() { return userAgent; }
-
-	protected void setRequestHeader(ClientStreamConnection pConnection, String pHeader, String pValue) {
-		URLConnection conn = ((SunClientConnection) pConnection).conn;
-		conn.setRequestProperty(pHeader, pValue);
-	}
-
-	protected ClientStreamConnection newConnection(XmlRpcStreamRequestConfig pConfig) throws XmlRpcClientException {
-		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pConfig;
+	public Object sendRequest(XmlRpcRequest pRequest) throws XmlRpcException {
+		XmlRpcHttpClientConfig config = (XmlRpcHttpClientConfig) pRequest.getConfig();
 		try {
-			URLConnection result = config.getServerURL().openConnection();
-			result.setUseCaches(false);
-			result.setDoInput(true);
-			result.setDoOutput(true);
-			return new SunClientConnection(result);
+			conn = config.getServerURL().openConnection();
+			conn.setUseCaches(false);
+			conn.setDoInput(true);
+			conn.setDoOutput(true);
 		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to create HTTP connection object", e);
+			throw new XmlRpcException("Failed to create URLConnection: " + e.getMessage(), e);
 		}
+		return super.sendRequest(pRequest);
 	}
 
-	protected void closeConnection(ClientStreamConnection pConnection) throws XmlRpcClientException {
-		URLConnection conn = ((SunClientConnection) pConnection).conn;
+	protected void setRequestHeader(String pHeader, String pValue) {
+		conn.setRequestProperty(pHeader, pValue);
+	}
+
+	protected void close() throws XmlRpcClientException {
 		if (conn instanceof HttpURLConnection) {
 			((HttpURLConnection) conn).disconnect();
 		}
 	}
 
-	protected OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcClientException {
-		try {
-			return ((SunClientConnection) pConnection).conn.getOutputStream();
-		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to obtain output stream to server", e);
-		}
+	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig) {
+		return HttpUtil.isUsingGzipEncoding(conn.getHeaderField("Content-Encoding"));
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection)
-			throws XmlRpcClientException {
+	protected InputStream getInputStream() throws XmlRpcException {
 		try {
-			return ((SunClientConnection) pConnection).conn.getInputStream();
+			return conn.getInputStream();
 		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to obtain input stream from server", e);
+			throw new XmlRpcException("Failed to create input stream: " + e.getMessage(), e);
 		}
 	}
 
-	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection,
-										 byte[] pContent)
-			throws XmlRpcClientException {
-		URLConnection conn = ((SunClientConnection) pConnection).conn;
+	protected void writeRequest(RequestWriter pWriter) throws XmlRpcException {
+		OutputStream ostream;
 		try {
-			OutputStream ostream = conn.getOutputStream();
-			ostream.write(pContent);
-			ostream.close();
+			 ostream = conn.getOutputStream();
 		} catch (IOException e) {
-			throw new XmlRpcClientException("Failed to send request to server: " + e.getMessage(), e);
+			throw new XmlRpcException("Failed to create output stream: " + e.getMessage(), e);
 		}
-		return newInputStream(pConfig, pConnection);
-	}
-
-	protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig pConfig, ClientStreamConnection pConnection) {
-		URLConnection conn = ((SunClientConnection) pConnection).conn;
-		return HttpUtil.isUsingGzipEncoding(conn.getHeaderField("Content-Encoding"));
+		pWriter.write(ostream);
 	}
 }

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/LocalStreamConnection.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/LocalStreamConnection.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/LocalStreamConnection.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/LocalStreamConnection.java Sat Mar 25 14:59:47 2006
@@ -1,41 +1,43 @@
 package org.apache.xmlrpc.common;
 
 import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 
 
-/** Implementation of {@link StreamConnection} for
+/** Implementation of {@link ServerStreamConnection} for
  * use by the
  * {@link org.apache.xmlrpc.client.XmlRpcLocalStreamTransport}.
  */
 public class LocalStreamConnection
-		implements ClientStreamConnection, ServerStreamConnection {
-	private ByteArrayOutputStream ostream, istream;
+		implements ServerStreamConnection {
+	private final InputStream request;
+	private final XmlRpcStreamRequestConfig config;
+	private final ByteArrayOutputStream response = new ByteArrayOutputStream();
 
-	/** Returns the output stream, to which the response
-	 * is being written.
+	/** Creates a new instance with the given request stream.
 	 */
-	public ByteArrayOutputStream getOstream() {
-		return ostream;
+	public LocalStreamConnection(XmlRpcStreamRequestConfig pConfig, 
+			InputStream pRequest) {
+		config = pConfig;
+		request = pRequest;
 	}
 
-	/** Sets the output stream, to which the response
-	 * is being written.
+	/** Returns the request stream.
 	 */
-	public void setOstream(ByteArrayOutputStream pOstream) {
-		ostream = pOstream;
+	public InputStream getRequest() {
+		return request;
 	}
 
-	/** Returns the input stream, to which the request
-	 * is being written.
+	/** Returns the request configuration.
 	 */
-	public ByteArrayOutputStream getIstream() {
-		return istream;
+	public XmlRpcStreamRequestConfig getConfig() {
+		return config;
 	}
 
-	/** Sets the input stream, to which the request
-	 * is being written.
+	/** Returns an output stream, to which the response
+	 * may be written.
 	 */
-	public void setIstream(ByteArrayOutputStream pIstream) {
-		istream = pIstream;
+	public ByteArrayOutputStream getResponse() {
+		return response;
 	}
 }

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/TypeFactoryImpl.java Sat Mar 25 14:59:47 2006
@@ -85,7 +85,8 @@
 	}
 
 	/** Returns the controller, which operates the type factory.
-	 * @return The controller, an instance of {@link XmlRpcClient},
+	 * @return The controller, an instance of
+	 * {@link org.apache.xmlrpc.client.XmlRpcClient},
 	 * or {@link org.apache.xmlrpc.server.XmlRpcServer}.
 	 */
 	public XmlRpcController getController() {

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcStreamRequestProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcStreamRequestProcessor.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcStreamRequestProcessor.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcStreamRequestProcessor.java Sat Mar 25 14:59:47 2006
@@ -1,7 +1,5 @@
 package org.apache.xmlrpc.common;
 
-import java.io.IOException;
-
 import org.apache.xmlrpc.XmlRpcException;
 
 
@@ -13,8 +11,6 @@
 	 * object and processes the request, writing the
 	 * result to the same connection object.
 	 * @throws XmlRpcException Processing the request failed.
-	 * @throws IOException An I/O error occurred while reading
-	 * the response, or writing the result.
 	 */
-	void execute(XmlRpcStreamRequestConfig pConfig, ServerStreamConnection pConnection) throws IOException, XmlRpcException;
+	void execute(XmlRpcStreamRequestConfig pConfig, ServerStreamConnection pConnection) throws XmlRpcException;
 }

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorker.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorker.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorker.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorker.java Sat Mar 25 14:59:47 2006
@@ -35,9 +35,7 @@
 	/** Performs a synchronous request. The client worker extends
 	 * this interface with the ability to perform asynchronous
 	 * requests.
-	 * @param pController The workers controller.
 	 * @param pRequest The request being performed.
-	 * @param pConfig The request configuration.
 	 * @return The requests result.
 	 * @throws XmlRpcException Performing the request failed.
 	 */

Modified: webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorkerFactory.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorkerFactory.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorkerFactory.java (original)
+++ webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/common/XmlRpcWorkerFactory.java Sat Mar 25 14:59:47 2006
@@ -35,7 +35,7 @@
 	}
 
 	/** Creates a new worker instance.
-	 * @return New instance of {@link XmlRpcClientWorker}.
+	 * @return New instance of {@link XmlRpcWorker}.
 	 */
 	protected abstract XmlRpcWorker newWorker();
 
@@ -49,7 +49,7 @@
 	}
 
 	/** Returns a worker for synchronous processing.
-	 * @return An instance of {@link XmlRpcClientWorker}, which is ready
+	 * @return An instance of {@link XmlRpcWorker}, which is ready
 	 * for use.
 	 * @throws XmlRpcLoadException The clients maximum number of concurrent
 	 * threads is exceeded.

Modified: webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/metadata/Util.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/metadata/Util.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/metadata/Util.java (original)
+++ webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/metadata/Util.java Sat Mar 25 14:59:47 2006
@@ -50,44 +50,44 @@
 	 * queried.
 	 * @return Signature, if known, or null.
 	 */
-	public static String getSignatureType(Class type) {
-		if (type == Integer.TYPE || type == Integer.class)
+	public static String getSignatureType(Class pType) {
+		if (pType == Integer.TYPE || pType == Integer.class)
 			return "int";
-		if (type == Double.TYPE || type == Double.class)
+		if (pType == Double.TYPE || pType == Double.class)
 			return "double";
-		if (type == Boolean.TYPE || type == Boolean.class)
+		if (pType == Boolean.TYPE || pType == Boolean.class)
 			return "boolean";
-		if (type == String.class)
+		if (pType == String.class)
 			return "string";
-		if (Object[].class.isAssignableFrom(type)
-			||  List.class.isAssignableFrom(type))
+		if (Object[].class.isAssignableFrom(pType)
+			||  List.class.isAssignableFrom(pType))
 			return "array";
-		if (Map.class.isAssignableFrom(type))
+		if (Map.class.isAssignableFrom(pType))
 			return "struct";
-		if (Date.class.isAssignableFrom(type)
-			||  Calendar.class.isAssignableFrom(type))
+		if (Date.class.isAssignableFrom(pType)
+			||  Calendar.class.isAssignableFrom(pType))
 			return "dateTime.iso8601";
-		if (type == byte[].class)
+		if (pType == byte[].class)
 			return "base64";
 
 		// extension types
-		if (type == void.class)
+		if (pType == void.class)
 			return "ex:nil";
-		if (type == Byte.TYPE || type == Byte.class)
+		if (pType == Byte.TYPE || pType == Byte.class)
 			return "ex:i1";
-		if (type == Short.TYPE || type == Short.class)
+		if (pType == Short.TYPE || pType == Short.class)
 			return "ex:i2";
-		if (type == Long.TYPE || type == Long.class)
+		if (pType == Long.TYPE || pType == Long.class)
 			return "ex:i8";
-		if (type == Float.TYPE || type == Float.class)
+		if (pType == Float.TYPE || pType == Float.class)
 			return "ex:float";
-		if (Node.class.isAssignableFrom(type))
+		if (Node.class.isAssignableFrom(pType))
 			return "ex:node";
 		if (jaxbElementClass != null
-			&&  jaxbElementClass.isAssignableFrom(type)) {
+			&&  jaxbElementClass.isAssignableFrom(pType)) {
 			return "ex:jaxbElement";
 		}
-		if (Serializable.class.isAssignableFrom(type))
+		if (Serializable.class.isAssignableFrom(pType))
 			return "base64";
 
 		// give up

Modified: webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcLocalStreamServer.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcLocalStreamServer.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcLocalStreamServer.java (original)
+++ webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcLocalStreamServer.java Sat Mar 25 14:59:47 2006
@@ -1,6 +1,5 @@
 package org.apache.xmlrpc.server;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -24,17 +23,15 @@
 	}
 	protected InputStream newInputStream(XmlRpcStreamRequestConfig pConfig, ServerStreamConnection pConnection) throws IOException {
 		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		return new ByteArrayInputStream(lsc.getOstream().toByteArray());
+		return lsc.getRequest();
 	}
 	protected OutputStream newOutputStream(XmlRpcStreamRequestConfig pConfig, ServerStreamConnection pConnection) throws IOException {
 		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		ByteArrayOutputStream istream = new ByteArrayOutputStream();
-		lsc.setIstream(istream);
-		return istream;
+		return lsc.getResponse();
 	}
 	protected void closeConnection(ServerStreamConnection pConnection) throws IOException {
 		LocalStreamConnection lsc = (LocalStreamConnection) pConnection;
-		final ByteArrayOutputStream istream = lsc.getIstream();
+		final ByteArrayOutputStream istream = lsc.getResponse();
 		if (istream != null) {
 			try { istream.close(); } catch (Throwable ignore) {}
 		}

Modified: webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcStreamServer.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcStreamServer.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcStreamServer.java (original)
+++ webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/server/XmlRpcStreamServer.java Sat Mar 25 14:59:47 2006
@@ -181,11 +181,10 @@
 	 * @param pConfig The request configuration.
 	 * @param pConnection The "connection" being processed.
 	 * @throws XmlRpcException Processing the request failed.
-	 * @throws IOException An I/O error occurred.
 	 */
 	public void execute(XmlRpcStreamRequestConfig pConfig,
 						ServerStreamConnection pConnection)
-			throws IOException, XmlRpcException {
+			throws XmlRpcException {
 		log.debug("execute: ->");
 		try {
 			Object result;
@@ -240,6 +239,9 @@
 			}
 			closeConnection(pConnection);
 			pConnection = null;
+		} catch (IOException e) {
+			throw new XmlRpcException("I/O error while processing request: "
+					+ e.getMessage(), e);
 		} finally {
 			if (pConnection != null) { try { closeConnection(pConnection); } catch (Throwable ignore) {} }
 		}

Modified: webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/WebServer.java
URL: http://svn.apache.org/viewcvs/webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/WebServer.java?rev=388849&r1=388848&r2=388849&view=diff
==============================================================================
--- webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/WebServer.java (original)
+++ webservices/xmlrpc/trunk/server/src/main/java/org/apache/xmlrpc/webserver/WebServer.java Sat Mar 25 14:59:47 2006
@@ -40,10 +40,10 @@
 	private class AddressMatcher {
 		private final int pattern[];
 		
-		AddressMatcher(String address) {
+		AddressMatcher(String pAddress) {
 			try {
 				pattern = new int[4];
-				StringTokenizer st = new StringTokenizer(address, ".");
+				StringTokenizer st = new StringTokenizer(pAddress, ".");
 				if (st.countTokens() != 4) {
 					throw new IllegalArgumentException();
 				}
@@ -56,7 +56,7 @@
 					}
 				}
 			} catch (Exception e) {
-				throw new IllegalArgumentException("\"" + address
+				throw new IllegalArgumentException("\"" + pAddress
 						+ "\" does not represent a valid IP address");
 			}
 		}