Re: [Fwd: Re: replace request]

Lv, Qiang wrote:

> --
> -------------------------------------------------
> Qiang Lv
> room 4220, ITC building
> CIS department, NJIT
> University Heights
> Newark, NJ 07102
> Tel: 973-596-2863(O)     973-596-2594(H)
> Fax: 973-596-5777
> ------------------------------------------------
>
>   ---------------------------------------------------------------------------
>
> Subject: Re: replace request
> Date: Wed, 18 Feb 1998 09:50:15 -0500
> From: "Lv, Qiang" <qianglu@cis.njit.edu>
> To: pazandak@OBJS.com
> References: <Pine.SOL.3.91.980217164002.2085A-100000@space> <34EA124C.9D49E5B6@OBJS.com>
>
> Hi Paul,
>
> ...
> Can I write a perform() method in my filter to override superclass's
> method? If so, is perform() method the only one to be overrided?
>
> Thanks,
> Qiang

You can call perform() or something like it... Try:

    request.getManager().runRequest(newrequest);

    request.getClient().processRequest(newrequest);
    (or maybe
      request.getClient().getServer().perform(newrequest);)

It depends upon which Request class you are using (there
are two request classes). Look at the interface for Request.
The first stmt is for w3c.www.protocol.http.request, the latter
two are applicable to w3c.jigsaw.http.request. For a proxy filter
I would suspect you are using the former.

Paul.

>
>
> Paul Pazandak wrote:
> >
> > I agree that your approach will not work.  What I had suggested
> > is that you modify the request object. Your code simply reassigns
> > a local attribute to reference a different object.
> >
> > What you need to do is use the interface of the Request object
> > to modify the object itself, e.g.
> >
> > if (conditions) {
> >     request.setURLPath(...)
> > }
> >
> > Paul.
> >
> > Lv, Qiang wrote:
> >
> > > On Tue, 17 Feb 1998, Paul Pazandak wrote:
> > >
> > > >
> > > > You should be able to simply modify the Request object and return it.
> > > It seems I can not RETURN that Request object to Jigsaw core. I write my
> > > filter's ingoingFilter method like this:
> > >
> > >         Request AnotherRequest;
> > > public Reply ingoingFilter(Request request) {
> > >         if (conditons) {
> > >                 request = AnotherRequest;
> > >         }
> > >         return null;
> > > }
> > >
> > > But the fact is Jigsaw did use the old request, instead of the new
> > > AnotherRequest as its forward request. I think it is normal because that
> > > request was passed to ingoingFilter just as an instance, what I did
> > > within the ingoingFilter will not effect the outside request. Therefore
> > > my following question araised.
> > >
> > > Thanks,
> > > Qiang
> > >
> > > >
> > > > Paul.
> > > >
> > > >
> > > >
> > > > Lv, Qiang wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I sucessfully set up Jigsaw as a proxy server. Now I can intercept
> > > > > request from clients in my filter. I want to check these requests, then
> > > > > replace some requests with mine in some conditions. The problem is:
> > > > > ingoingFilter only get a instance of Request. How can I replace that
> > > > > request with a new one and let Jigsaw forward my new request?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > -------------------------------------------------
> > > > > Qiang Lv
>

   --

********************************************************************
Paul Pazandak                                      pazandak@objs.com
Object Services and Consulting, Inc.             http://www.objs.com
Minneapolis, Minnesota 55420-5409                       612-881-6498
********************************************************************

Received on Wednesday, 18 February 1998 10:48:05 UTC