ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@gmail.com>
Subject Re: XML-RPC embedded in Jetty
Date Thu, 24 Aug 2006 22:25:35 GMT
Bellekens, P.A.E. wrote:

> XmlRpcLocalStreamServer server = new XmlRpcLocalStreamServer();

You cannot use the XmlRpcLocal stuff. This was simply meant as an 
example of a streamserver class with custom streams.


> LimitedInputStream(getInputStream(), getInputStream().available()));

This is almost definitely wrong. InputStream.available() returns the 
number of bytes, which are available *now*. However, this number may 
change, if more data arrives.

Besides, if headers are available, then you should consider subclassing 
the XmlRpcHttpServer, not the XmlRpcStreamServer.

The only meaningful value is what the client sends as the Content-Length 
header. If that value is -1 or you don't have access to the 
Content-Length header, then you shouldn't use the LimitedInputStream.

Without knowing Jetty, I'd assume from your code, that a good example 
might look like

     public class JettyConnection implements ServerStreamConnection {
         private final InputStream inputStream;
         private final OutputStream outputStream;
         public JettyConnection(InputStream pInputStream,
             OutputStream pOutputStream) {
             inputStream = pInputStream:
             outputStream = pOutputStream;
         }
         public InputStream newInputStream() {
             return inputStream;
         }
         public OutputStream newOutputStream() {
             return outputStream;
         }
     }

     public class JettyServer extends XmlRpcStreamServer {
     }

Now call the JettyServer's method

     execute(XmlRpcStreamRequestConfig, ServerStreamConnection)

by passing an instance of JettyConnection and a suitable configuration 
object.


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-user-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-user-help@ws.apache.org


Mime
View raw message