[Fwd: Re: replace request]

-- 
-------------------------------------------------
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
------------------------------------------------

Forwarded message 1

  • From: Lv, Qiang <qianglu@cis.njit.edu>
  • Date: Wed, 18 Feb 1998 09:50:15 -0500
  • Subject: Re: replace request
  • To: pazandak@OBJS.com
  • Message-ID: <34EAF526.E07@cis.njit.edu>
Hi Paul,

Thanks for the reply. But it still did not solve my problem. Say, I
saved some Requests that Jigsaw processed before. I don't care what the
source request from client are. I just saved those Requests somewhere.
If conditions allowed, I want to active these Requests to replace the
current Request. Actually, the current Request is just a signal for my
filter to replace with a specific Request. (It had be proccessed before)

In your approach, I have to extract all information from Request, and
save these non-structure information. Then when I want to replace a
Request, set those saved information to the current Request. Therefore
problems araised:
1. How to extract ALL information from a Request object?
2. How to restore all these information back to a Request object?
(e.g. I don't know how to get/set content of a Request.)
So I don't think the above is the good choice for my requirement. Is
there any other solutions? Since I already had a completed Request
object, active it as the current Request is the best and safest
solution. Then, How?

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

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
> > > > 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
> > > > ------------------------------------------------
> > >
> > >
> > >
> > >
> 
>    --
> 
> ********************************************************************
> Paul Pazandak                                      pazandak@objs.com
> Object Services and Consulting, Inc.             http://www.objs.com
> Minneapolis, Minnesota 55420-5409                       612-881-6498
> ********************************************************************

-- 
-------------------------------------------------
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
------------------------------------------------

Received on Wednesday, 18 February 1998 10:10:46 UTC