Issue Details (XML | Word | Printable)

Key: XMLRPC-107
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Catalin Hritcu
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XML-RPC

Allowing other Socket types to be used with XmlRpcLiteHttpTransport

Created: 24/Aug/06 02:59 PM   Updated: 05/Oct/06 08:57 PM
Return to search
Component/s: Source
Affects Version/s: 3.0rc1
Fix Version/s: 3.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File xmlrpc-3.0rc1.patch 2006-08-24 02:59 PM Catalin Hritcu 0.9 kB
Text File Licensed for inclusion in ASF works xmlrpc-trunk.patch 2006-08-25 06:42 AM Catalin Hritcu 0.8 kB
Text File Licensed for inclusion in ASF works xmlrpc-trunk.patch 2006-08-25 06:32 AM Catalin Hritcu 0.6 kB

Resolution Date: 24/Aug/06 08:42 PM


 Description  « Hide
Since the p2psockets port of xmlrpc is obsolete (version 1.2b), I decided today to do my own port of 3.0rc1. Since p2psockets replace normal java.net sockets this task is quite easy. On the server at least all I had to do was to subclass WebServer or ServletWebServer and provide an implementation for the createServerSocket method, that now creates a P2PServerSocket instead of a ServerSocket. However, on the client side things are a little uglier, since here XmlRpcLiteHttpTransport does not provide such an extension point. The private getOutputStream method creates a normal Socket, and there is little I can do about it ... other than copying the whole file, changing that single line and the class name. Is there any easy way to do such an extension? If not, would it be possible to have a protected createSocket method in the XmlRpcLiteHttpTransport class that is invoked in the getOutputStream method?

PS: In case you think this it is a good idea, I attached a patch.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Jochen Wiedmann added a comment - 24/Aug/06 08:42 PM
Applied, thank you!

Catalin Hritcu added a comment - 25/Aug/06 06:22 AM
Sorry, but the current resolution is NOT satisfactory. Now the newSocket method can be overridden:

    protected Socket newSocket() throws UnknownHostException, IOException {
        return new Socket(hostname, port);
    }

However, hostname and port are private fields, so they cannot be accessed in a subclass. Probably the best way to fix this would be to give them as arguments to the newSocket method (like in the attached patch).

    protected Socket newSocket(String hostname, int port) throws UnknownHostException, IOException {
        return new Socket(hostname, port);
    }

Catalin Hritcu added a comment - 25/Aug/06 06:42 AM
Sorry for the last attachment, this new one should be used.

Jochen Wiedmann added a comment - 25/Aug/06 06:47 AM
Sorry, fixed!

Catalin Hritcu added a comment - 25/Aug/06 06:58 AM
It works, thank you. Now the conversion to p2psockets is trivial.

Jochen Wiedmann added a comment - 05/Oct/06 08:57 PM
Release 3.0 published, closing.