DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12552>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12552 [PATCH] Refactored HTTP request out of XmlRpcClient.execute Summary: [PATCH] Refactored HTTP request out of XmlRpcClient.execute Product: XML-RPC Version: unspecified Platform: All OS/Version: Other Status: NEW Severity: Minor Priority: Other Component: Source AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] =================================================================== RCS file: /home/cvspublic/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v retrieving revision 1.12 diff -u -r1.12 XmlRpcClient.java --- org/apache/xmlrpc/XmlRpcClient.java 9 Aug 2002 10:27:44 -0000 1.12 +++ org/apache/xmlrpc/XmlRpcClient.java 11 Sep 2002 22:36:48 -0000 @@ -382,37 +382,12 @@ } /** - * Execute an XML-RPC call. + * Execute an HTTP request. + * + * @param url {@link java.net.URL} to which we direct the request */ - Object execute(String method, Vector params) - throws XmlRpcException, IOException - { - fault = false; - long now = 0; - - if (XmlRpc.debug) - { - System.out.println("Client calling procedure '" + method - + "' with parameters " + params); - now = System.currentTimeMillis(); - } - - try - { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - - if (buffer == null) - { - buffer = new ByteArrayOutputStream(); - } - else - { - buffer.reset(); - } - - XmlWriter writer = new XmlWriter(buffer, encoding); - writeRequest(writer, method, params); - writer.flush(); + private void executeHttpRequest(URL url) throws IOException { + try { byte[] request = buffer.toByteArray(); URLConnection con = url.openConnection(); @@ -442,6 +417,40 @@ } throw new IOException(x.getMessage()); } + } + + /** + * Execute an XML-RPC call. + */ + Object execute(String method, Vector params) + throws XmlRpcException, IOException + { + fault = false; + long now = 0; + + if (XmlRpc.debug) + { + System.out.println("Client calling procedure '" + method + + "' with parameters " + params); + now = System.currentTimeMillis(); + } + + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + + if (buffer == null) + { + buffer = new ByteArrayOutputStream(); + } + else + { + buffer.reset(); + } + + XmlWriter writer = new XmlWriter(buffer, encoding); + writeRequest(writer, method, params); + writer.flush(); + + executeHttpRequest(url); if (fault) {