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 Henri Gomez <he...@gmail.com> on 2005/03/04 15:42:58 UTC

Re: Status of apache xmlrpc

Here is a patch to support GZIP in CommonsXmlRpcTransport.java :

Anyone to revue and commit to HEAD ?

Regards

---

--- CommonsXmlRpcTransport.java.orig    2005-03-04 15:32:24.000000000 +0100
+++ CommonsXmlRpcTransport.java 2005-03-04 15:33:50.000000000 +0100
@@ -59,6 +59,8 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
+import java.util.zip.GZIPInputStream;
+
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.HttpClient;
@@ -97,11 +99,16 @@
     private HttpClient client;
     private final Header userAgentHeader = new Header("User-Agent",
XmlRpc.version);
     private boolean http11 = false; // defaults to HTTP 1.0
+    private boolean gzip = false;

     public InputStream sendXmlRpc(byte[] request) throws IOException,
XmlRpcClientException {
         PostMethod method = new PostMethod(url.toString());
         method.setHttp11(http11);
         method.setRequestHeader(new Header("Content-Type", "text/xml"));
+
+        if (gzip)
+               method.setRequestHeader(new Header("Accept-Encoding", "gzip"));
+
         method.setRequestHeader(userAgentHeader);
         // TODO: authentication not implemented yet
         method.setRequestBody(new ByteArrayInputStream(request));
@@ -109,14 +116,32 @@
         HostConfiguration hostConfig = new HostConfiguration();
         hostConfig.setHost(hostURI);
         client.executeMethod(hostConfig, method);
-        return method.getResponseBodyAsStream();
+
+        boolean lgzipo = false;
+
+        Header lHeader = method.getResponseHeader( "Content-Encoding" );
+        if ( lHeader != null ) {
+            String lValue = lHeader.getValue();
+            if ( lValue != null )
+                       lgzipo = (lValue.indexOf( "gzip" ) >= 0);
+        }
+
+        if (lgzipo)
+               return( new GZIPInputStream(
method.getResponseBodyAsStream() ) );
+        else
+               return method.getResponseBodyAsStream();
     }

     public void setHttp11(boolean http11) {
         this.http11 = http11;
     }

+    public void setGzip(boolean gzip) {
+        this.gzip = gzip;
+    }
+
     public void setUserAgent(String userAgent) {
         userAgentHeader.setValue(userAgent);
     }
 }
+

Re: Status of apache xmlrpc

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Jochen,

I assume that

+) patch 3) and 6) could  also go  into CVS HEAD of xml-rpc?
+) you are a XML-RPC committer .... hint, hint?!

I updated the Maven project

+) to fix the broken link the mail archives
+) added a few standard reports

The site can be found at http://www.apache.org/~sgoeschl/xmlrpc/

Cheers,

Siegfried Goeschl

Jochen Wiedmann wrote:

> Siegfried Goeschl wrote:
>
>> as a casual XML-RPC user I would like to ask who would volunteer to 
>> maintain the XML-RPC project?! If we have volunteers we can contact 
>> the existing committers to promote an existing contributor to become 
>> a committer ... ;-)
>
>
> I am relatively acticely maintaining a patch that extends xml-rpc. See 
> http://ws.apache.org/~jochen/patches. The problem is, that my 
> direction is questionable: My intention is to extend xml-rpc over the 
> spec, as long as there is a careful separation between things that are 
> covered by the spec (and are enabled by default) and others (which 
> must be explicitly enabled). See below.
>
>
> Jochen
>
>
> Apache XmlRpc patch
> ===================
>
> This is a patch file for Apache XmlRpc, as of 20-Jun-2004. It is 
> available from
> http://ws.apache.org/~jochen/patches/ and includes the following changes:
>
> 1.) Uses a SAX 2 parser, rather than MinML or another SAX 1 parser. See
>
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=875 
>
>
> 2.) Supports null values by setting 
> XmlRpcClient.isSupportingTypeExtensions(true)
>     and XmlRpcServer.isSupportingTypeExtensions(true). See
>
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=908 
>
>
> 3.) Replaced the deprecated com.sun.net.ssl classes with javax.net.ssl.
>     See 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=888 
>
>
> 4.) Uses a random, free server port for the test suite, rather than 
> the fixed
>     ports 8081, etc. See
>
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=901 
>
>
> 5.) Supports byte, short, long, and float by enabling type extensions. 
> Enabling
>     these extensions works as in 2.)
>
> 6.) Patch for reduced memory use, see
>     http://marc.theaimsgroup.com/?l=xmlrpc-dev&m=108984675831883&w=2
>
> 7.) Supports instances of java.io.Serializable by enabling type 
> extensions. Serializable
>     objects are converted into a byte array, gzipped, and base64 
> encoded. See
>     2.) for how to enable type extensions.
>


Re: Status of apache xmlrpc

Posted by Jochen Wiedmann <jo...@gmail.com>.
Siegfried Goeschl wrote:

> as a casual XML-RPC user I would like to ask who would volunteer to 
> maintain the XML-RPC project?! If we have volunteers we can contact the 
> existing committers to promote an existing contributor to become a 
> committer ... ;-)

I am relatively acticely maintaining a patch that extends xml-rpc. See 
http://ws.apache.org/~jochen/patches. The problem is, that my direction 
is questionable: My intention is to extend xml-rpc over the spec, as 
long as there is a careful separation between things that are covered by 
the spec (and are enabled by default) and others (which must be 
explicitly enabled). See below.


Jochen


Apache XmlRpc patch
===================

This is a patch file for Apache XmlRpc, as of 20-Jun-2004. It is 
available from
http://ws.apache.org/~jochen/patches/ and includes the following changes:

1.) Uses a SAX 2 parser, rather than MinML or another SAX 1 parser. See
 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=875

2.) Supports null values by setting 
XmlRpcClient.isSupportingTypeExtensions(true)
     and XmlRpcServer.isSupportingTypeExtensions(true). See
 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=908

3.) Replaced the deprecated com.sun.net.ssl classes with javax.net.ssl.
     See 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=888

4.) Uses a random, free server port for the test suite, rather than the 
fixed
     ports 8081, etc. See
 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlrpc-dev@ws.apache.org&msgNo=901 


5.) Supports byte, short, long, and float by enabling type extensions. 
Enabling
     these extensions works as in 2.)

6.) Patch for reduced memory use, see
     http://marc.theaimsgroup.com/?l=xmlrpc-dev&m=108984675831883&w=2

7.) Supports instances of java.io.Serializable by enabling type 
extensions. Serializable
     objects are converted into a byte array, gzipped, and base64 
encoded. See
     2.) for how to enable type extensions.

Re: Status of apache xmlrpc

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi folks,

as a casual XML-RPC user I would like to ask who would volunteer to 
maintain the XML-RPC project?! If we have volunteers we can contact the 
existing committers to promote an existing contributor to become a 
committer ... ;-)

Cheers,

Siegfried Goeschl

James Russo wrote:

> I've submitted two patches awhile back. No response. I don't think 
> this project is actively maintained anymore. At least your patches are 
> on the mailing list archives for others if needed.
>
> -jr



Re: Status of apache xmlrpc

Posted by James Russo <jr...@halo3.net>.
I've submitted two patches awhile back. No response. I don't think this 
project is actively maintained anymore. At least your patches are on the 
mailing list archives for others if needed.

-jr

Henri Gomez wrote:

>Nobody to revue my GZIP patch and commit to HEAD ?
>
>
>On Fri, 4 Mar 2005 16:25:45 +0100, Henri Gomez <he...@gmail.com> wrote:
>  
>
>>Here is a patch to support GZIP in CommonsXmlRpcTransport.java :
>>
>>Anyone to revue and commit to HEAD ?
>>
>>Regards
>>
>>---
>>
>>--- CommonsXmlRpcTransport.java.orig    2005-03-04 15:32:24.000000000 +0100
>>+++ CommonsXmlRpcTransport.java 2005-03-04 15:33:50.000000000 +0100
>>@@ -59,6 +59,8 @@
>>import java.io.InputStream;
>>import java.io.IOException;
>>import java.net.URL;
>>+import java.util.zip.GZIPInputStream;
>>+
>>import org.apache.commons.httpclient.Header;
>>import org.apache.commons.httpclient.HostConfiguration;
>>import org.apache.commons.httpclient.HttpClient;
>>@@ -97,11 +99,16 @@
>>    private HttpClient client;
>>    private final Header userAgentHeader = new Header("User-Agent",
>>XmlRpc.version);
>>    private boolean http11 = false; // defaults to HTTP 1.0
>>+    private boolean gzip = false;
>>
>>    public InputStream sendXmlRpc(byte[] request) throws IOException,
>>XmlRpcClientException {
>>        PostMethod method = new PostMethod(url.toString());
>>        method.setHttp11(http11);
>>        method.setRequestHeader(new Header("Content-Type", "text/xml"));
>>+
>>+        if (gzip)
>>+               method.setRequestHeader(new Header("Accept-Encoding", "gzip"));
>>+
>>        method.setRequestHeader(userAgentHeader);
>>        // TODO: authentication not implemented yet
>>        method.setRequestBody(new ByteArrayInputStream(request));
>>@@ -109,14 +116,32 @@
>>        HostConfiguration hostConfig = new HostConfiguration();
>>        hostConfig.setHost(hostURI);
>>        client.executeMethod(hostConfig, method);
>>-        return method.getResponseBodyAsStream();
>>+
>>+        boolean lgzipo = false;
>>+
>>+        Header lHeader = method.getResponseHeader( "Content-Encoding" );
>>+        if ( lHeader != null ) {
>>+            String lValue = lHeader.getValue();
>>+            if ( lValue != null )
>>+                       lgzipo = (lValue.indexOf( "gzip" ) >= 0);
>>+        }
>>+
>>+        if (lgzipo)
>>+               return( new GZIPInputStream(
>>method.getResponseBodyAsStream() ) );
>>+        else
>>+               return method.getResponseBodyAsStream();
>>    }
>>
>>    public void setHttp11(boolean http11) {
>>        this.http11 = http11;
>>    }
>>
>>+    public void setGzip(boolean gzip) {
>>+        this.gzip = gzip;
>>+    }
>>+
>>    public void setUserAgent(String userAgent) {
>>        userAgentHeader.setValue(userAgent);
>>    }
>>}
>>+
>>
>>    
>>


Re: Status of apache xmlrpc

Posted by Henri Gomez <he...@gmail.com>.
Here is my latest patch which add :

gzip reply compression support
gzip request compression support (tested with Apache 2.x / mod_deflate)
basic user auth




On Wed, 9 Mar 2005 12:16:52 +0100, Henri Gomez <he...@gmail.com> wrote:
> As a tomcat commiter, I take a look at what Remy does in coyote HTTP
> 1.1 gzip support and also at what is allready done in Apache 2.x
> mod_deflate :
> 
> BTW : in Coyote HTTP11 the code is looking for gzip in Accept-Encoding :
> 
>         // Check if browser support gzip encoding
>         MessageBytes acceptEncodingMB =
>             request.getMimeHeaders().getValue("accept-encoding");
> 
>         if ((acceptEncodingMB == null)
>             || (acceptEncodingMB.indexOf("gzip") == -1))
>             return false;
> 
> indexOf gzip :-))
> 
> On Tue, 08 Mar 2005 21:25:07 +0100, Jochen Wiedmann
> <jo...@gmail.com> wrote:
> > Henri Gomez wrote:
> >
> > >Nobody to revue my GZIP patch and commit to HEAD ?
> >
> > Henri, some comments:
> >
> > 1.) The "Accept-Encoding" header transmitted by the client seems to me
> > to be RFC compliant, so that is fine.
> >
> > However, if the server is simply looking for the word "gzip" in the
> > header, that seems to me to be insufficient. For example, the following
> > might be handled wrongly:
> >
> >      Accept-Encoding: gzip;q=0.0, identity; q=0.5, *;q=0
> >
> > (I admit, that the example might be academic.) However, I'd recommend to
> > change the patch allong the lines of
> >
> >      public static boolean isUsingGzipEncoding(String pHeaderValue) {
> >                 if (pHeaderValue == null) {
> >                         return false;
> >          }
> >          for (StringTokenizer st = new StringTokenizer(pHeaderValue,
> >                                                        ",");
> >               st.hasMoreTokens();  ) {
> >              String encoding = st.nextToken();
> >              int offset = encoding.indexOf(';');
> >              if (offset >= 0) {
> >                  encoding = encoding.substring(0, offset);
> >              }
> >              if ("gzip".equals(encoding)) {
> >                 return true;
> >              }
> >          }
> >          return false;
> >      }
> >
> > 2.) Any change, that you handle compression of the requests as well?
> 
> I could do that if you want, I allready added the basic authentification ...
> 
> > 3.) Isn't your change worth a patch for the docs?
> 
> I'm not a commiter of xml-rpc project :)
>

Re: Status of apache xmlrpc

Posted by Henri Gomez <he...@gmail.com>.
As a tomcat commiter, I take a look at what Remy does in coyote HTTP
1.1 gzip support and also at what is allready done in Apache 2.x
mod_deflate :

BTW : in Coyote HTTP11 the code is looking for gzip in Accept-Encoding :

        // Check if browser support gzip encoding
        MessageBytes acceptEncodingMB =
            request.getMimeHeaders().getValue("accept-encoding");

        if ((acceptEncodingMB == null)
            || (acceptEncodingMB.indexOf("gzip") == -1))
            return false;

indexOf gzip :-))




On Tue, 08 Mar 2005 21:25:07 +0100, Jochen Wiedmann
<jo...@gmail.com> wrote:
> Henri Gomez wrote:
> 
> >Nobody to revue my GZIP patch and commit to HEAD ?
> 
> Henri, some comments:
> 
> 1.) The "Accept-Encoding" header transmitted by the client seems to me
> to be RFC compliant, so that is fine.
> 
> However, if the server is simply looking for the word "gzip" in the
> header, that seems to me to be insufficient. For example, the following
> might be handled wrongly:
> 
>      Accept-Encoding: gzip;q=0.0, identity; q=0.5, *;q=0
> 
> (I admit, that the example might be academic.) However, I'd recommend to
> change the patch allong the lines of
> 
>      public static boolean isUsingGzipEncoding(String pHeaderValue) {
>                 if (pHeaderValue == null) {
>                         return false;
>          }
>          for (StringTokenizer st = new StringTokenizer(pHeaderValue,
>                                                        ",");
>               st.hasMoreTokens();  ) {
>              String encoding = st.nextToken();
>              int offset = encoding.indexOf(';');
>              if (offset >= 0) {
>                  encoding = encoding.substring(0, offset);
>              }
>              if ("gzip".equals(encoding)) {
>                 return true;
>              }
>          }
>          return false;
>      }
> 
> 2.) Any change, that you handle compression of the requests as well?

I could do that if you want, I allready added the basic authentification ...

> 3.) Isn't your change worth a patch for the docs?

I'm not a commiter of xml-rpc project :)

Re: Status of apache xmlrpc

Posted by Jochen Wiedmann <jo...@gmail.com>.
Henri Gomez wrote:

>Nobody to revue my GZIP patch and commit to HEAD ?

Henri, some comments:

1.) The "Accept-Encoding" header transmitted by the client seems to me 
to be RFC compliant, so that is fine.

However, if the server is simply looking for the word "gzip" in the 
header, that seems to me to be insufficient. For example, the following 
might be handled wrongly:

     Accept-Encoding: gzip;q=0.0, identity; q=0.5, *;q=0

(I admit, that the example might be academic.) However, I'd recommend to 
change the patch allong the lines of

     public static boolean isUsingGzipEncoding(String pHeaderValue) {
		if (pHeaderValue == null) {
			return false;
         }
         for (StringTokenizer st = new StringTokenizer(pHeaderValue,
                                                       ",");
              st.hasMoreTokens();  ) {
             String encoding = st.nextToken();
             int offset = encoding.indexOf(';');
             if (offset >= 0) {
                 encoding = encoding.substring(0, offset);
             }
             if ("gzip".equals(encoding)) {
             	return true;
             }
         }
         return false;
     }

2.) Any change, that you handle compression of the requests as well?

3.) Isn't your change worth a patch for the docs?


Jochen

Re: Status of apache xmlrpc

Posted by Henri Gomez <he...@gmail.com>.
You should I contact ?


On Tue, 08 Mar 2005 12:11:02 +0100, Jochen Wiedmann
<jo...@gmail.com> wrote:
> Henri Gomez wrote:
> 
> > Nobody to revue my GZIP patch and commit to HEAD ?
> 
> Noone with sufficient privileges. :-)
>

Re: Status of apache xmlrpc

Posted by Jochen Wiedmann <jo...@gmail.com>.
Henri Gomez wrote:

> Nobody to revue my GZIP patch and commit to HEAD ?

Noone with sufficient privileges. :-)

Re: Status of apache xmlrpc

Posted by Henri Gomez <he...@gmail.com>.
Nobody to revue my GZIP patch and commit to HEAD ?


On Fri, 4 Mar 2005 16:25:45 +0100, Henri Gomez <he...@gmail.com> wrote:
> Here is a patch to support GZIP in CommonsXmlRpcTransport.java :
> 
> Anyone to revue and commit to HEAD ?
> 
> Regards
> 
> ---
> 
> --- CommonsXmlRpcTransport.java.orig    2005-03-04 15:32:24.000000000 +0100
> +++ CommonsXmlRpcTransport.java 2005-03-04 15:33:50.000000000 +0100
> @@ -59,6 +59,8 @@
> import java.io.InputStream;
> import java.io.IOException;
> import java.net.URL;
> +import java.util.zip.GZIPInputStream;
> +
> import org.apache.commons.httpclient.Header;
> import org.apache.commons.httpclient.HostConfiguration;
> import org.apache.commons.httpclient.HttpClient;
> @@ -97,11 +99,16 @@
>     private HttpClient client;
>     private final Header userAgentHeader = new Header("User-Agent",
> XmlRpc.version);
>     private boolean http11 = false; // defaults to HTTP 1.0
> +    private boolean gzip = false;
> 
>     public InputStream sendXmlRpc(byte[] request) throws IOException,
> XmlRpcClientException {
>         PostMethod method = new PostMethod(url.toString());
>         method.setHttp11(http11);
>         method.setRequestHeader(new Header("Content-Type", "text/xml"));
> +
> +        if (gzip)
> +               method.setRequestHeader(new Header("Accept-Encoding", "gzip"));
> +
>         method.setRequestHeader(userAgentHeader);
>         // TODO: authentication not implemented yet
>         method.setRequestBody(new ByteArrayInputStream(request));
> @@ -109,14 +116,32 @@
>         HostConfiguration hostConfig = new HostConfiguration();
>         hostConfig.setHost(hostURI);
>         client.executeMethod(hostConfig, method);
> -        return method.getResponseBodyAsStream();
> +
> +        boolean lgzipo = false;
> +
> +        Header lHeader = method.getResponseHeader( "Content-Encoding" );
> +        if ( lHeader != null ) {
> +            String lValue = lHeader.getValue();
> +            if ( lValue != null )
> +                       lgzipo = (lValue.indexOf( "gzip" ) >= 0);
> +        }
> +
> +        if (lgzipo)
> +               return( new GZIPInputStream(
> method.getResponseBodyAsStream() ) );
> +        else
> +               return method.getResponseBodyAsStream();
>     }
> 
>     public void setHttp11(boolean http11) {
>         this.http11 = http11;
>     }
> 
> +    public void setGzip(boolean gzip) {
> +        this.gzip = gzip;
> +    }
> +
>     public void setUserAgent(String userAgent) {
>         userAgentHeader.setValue(userAgent);
>     }
> }
> +
>

Re: Status of apache xmlrpc

Posted by Henri Gomez <he...@gmail.com>.
Here is a patch to support GZIP in CommonsXmlRpcTransport.java :

Anyone to revue and commit to HEAD ?

Regards

---

--- CommonsXmlRpcTransport.java.orig    2005-03-04 15:32:24.000000000 +0100
+++ CommonsXmlRpcTransport.java 2005-03-04 15:33:50.000000000 +0100
@@ -59,6 +59,8 @@
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
+import java.util.zip.GZIPInputStream;
+
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
@@ -97,11 +99,16 @@
    private HttpClient client;
    private final Header userAgentHeader = new Header("User-Agent",
XmlRpc.version);
    private boolean http11 = false; // defaults to HTTP 1.0
+    private boolean gzip = false;

    public InputStream sendXmlRpc(byte[] request) throws IOException,
XmlRpcClientException {
        PostMethod method = new PostMethod(url.toString());
        method.setHttp11(http11);
        method.setRequestHeader(new Header("Content-Type", "text/xml"));
+
+        if (gzip)
+               method.setRequestHeader(new Header("Accept-Encoding", "gzip"));
+
        method.setRequestHeader(userAgentHeader);
        // TODO: authentication not implemented yet
        method.setRequestBody(new ByteArrayInputStream(request));
@@ -109,14 +116,32 @@
        HostConfiguration hostConfig = new HostConfiguration();
        hostConfig.setHost(hostURI);
        client.executeMethod(hostConfig, method);
-        return method.getResponseBodyAsStream();
+
+        boolean lgzipo = false;
+
+        Header lHeader = method.getResponseHeader( "Content-Encoding" );
+        if ( lHeader != null ) {
+            String lValue = lHeader.getValue();
+            if ( lValue != null )
+                       lgzipo = (lValue.indexOf( "gzip" ) >= 0);
+        }
+
+        if (lgzipo)
+               return( new GZIPInputStream(
method.getResponseBodyAsStream() ) );
+        else
+               return method.getResponseBodyAsStream();
    }

    public void setHttp11(boolean http11) {
        this.http11 = http11;
    }

+    public void setGzip(boolean gzip) {
+        this.gzip = gzip;
+    }
+
    public void setUserAgent(String userAgent) {
        userAgentHeader.setValue(userAgent);
    }
}
+