W3C home > Mailing lists > Public > www-jigsaw@w3.org > September to October 2000

Modifying POST in ingoingFilter

From: Sheldon Conaty <sconaty@hotmail.com>
Date: Thu, 21 Sep 2000 06:26:46 -0400 (EDT)
To: www-jigsaw@w3.org
Message-ID: <F140DhtWrwuVjtQUGUz00000860@hotmail.com>
We are running Jigsaw as a proxy and from both in and out filter points we 
need to read and modify the requests and replies that pass through the 
server. Mostly this is fine as there are APIs in Jigsaw that allow us 
manipulate the data.

The problem we found is when we want to change the POST data in a request 
message. The org.w3c.jigsaw.http.Request class has a getInputStream() that 
we can use to read the incoming data. In our scenario we need to add 
additional data to this request and forward it to the origin server. We 
can't do this as there is no setStream() method on Request. We can modify 
replies as the org.w3c.jigsaw.http.Reply class does have a setStream() 
method.

Having considered a few alternatives we decided to extend the Request class 
directly as follows;

    public void setEncodedStream(InputStream is) {

        try {
            setContentLength (is.available()) ;
        } catch (IOException ex) {
        }

        try {
            setContentType (new
MimeType("application/x-www-form-urlencoded"));
        } catch (MimeTypeFormatException ignore) {
        }
        this.in = is;
    }

Our questions therefore are;

Is there a better way to do this? and if there is what is it? and if not
would W3C be interested in including this code (or some equivalent) in 
future releases of Jigsaw?

thanks

stephen
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.
Received on Thursday, 21 September 2000 08:03:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:34 GMT