jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: [patch] Two Cactus feature requests (was RE: Cactus - possible bug)
Date Tue, 16 Jul 2002 22:38:40 GMT
Hi Charles,

I was starting to apply your patch WRT setting the cookies in the
request when I started to ask myself some question about this ... :-)

Could you provide more details ? Certainly it is not about the session
cookie (jsessionid) as I don't see how it can relate to the Servlet
Config object ?

Can you send us the list of cookies that you need to set up when calling
a servlet ? Do you always need to set these cookies ?

My point is that Cactus need to abide by the Servlet 2.2 and 2.3 spec
and I don't see how what it is doing is not conformant to any part of
the spec.

The 2 HTTP request (run the test, get the result) are completely
independent (and are meant to be independent by design). The result of
the first request is saved in the application scope (not in the session
scope) and thus there doesn't need to be any cookie in the second
request.

I'm not against applying your patch, but I need more details to
understand the rationale.

Thanks
-Vincent

> -----Original Message-----
> From: Charles Massey [mailto:CMassey@corp.classmates.com]
> Sent: 15 July 2002 21:24
> To: 'Cactus Users List' (E-mail)
> Subject: [patch] Two Cactus feature requests (was RE: Cactus -
possible
> bug)
> 
> Hi Vincent,
> 
> I would like to submit to you two Cactus enhancements.  The first is
the
> one
> described below, involving sending the cookie to the test result post.
> 
> I have attached the source file that includes this patch.  In
> AbstractHttpClient.java I have added a few lines to add the cookies to
the
> resultsRequest.
> 
> 
>     private WebTestResult callGetResult(WebRequest theRequest,
>         AbstractAuthentication theAuthentication) throws Throwable
>     {
>         WebRequest resultsRequest = new WebRequest();
> 
>         // Add the cookies from the request used in the test
>         Vector cookies = theRequest.getCookies();
>         if (cookies != null) {
>             for (int i=0; i < cookies.size(); i++) {
>
resultsRequest.addCookie((Cookie)cookies.elementAt(i));
>             }
>         }
>         ...
>     }
> 
> Then in the doTest method, the call to the callGetResult method is
> modified
> to pass the WebRequest object used in the callRunTest method.
> 
>     public HttpURLConnection doTest(WebRequest theRequest)
>         throws Throwable
>     {
> 
>         // Open the first connection to the redirector to execute the
test
> on
>         // the server side
>         HttpURLConnection connection = callRunTest(theRequest);
> 
>         // Open the second connection to get the test results
>         WebTestResult result = callGetResult(theRequest,
> theRequest.getAuthentication());
>         ...
>     }
> 
> ---
> 
> My second feature request involves the addition of two new optional
> methods
> for any class that extends AbstractTestCase (i.e. ServletTestCase,
> JspTestCase, and FilterTestCase).  This would be a generic begin
method
> and
> a generic end method that if declared will be called automatically for
> every
> testXXX method.
> 
> They take this form:
> 
> public void begin(WebRequest theRequest);
> 
> public void end(WebResponse theResponse);
> 
> 
> 
> In the attached AbstractTestCase.java there are a set of new methods:
> 
> 1. callGenericBeginMethod
> 2. callGenericEndMethod
> 3. getGenericBeginMethodName
> 4. getGenericEndMethodName
> 
> The runGenericTest method is modified to make calls to the generic
methods
> and the specific base test method-name methods.
> 
> Let me know if you have any questions.
> 
> Thanks,
> Charley
> 
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > Sent: Friday, July 12, 2002 1:17 AM
> > To: 'Charles Massey'; 'Cactus Users List'
> > Subject: RE: Cactus - possible bug
> >
> >
> > Hi Charles,
> >
> > > -----Original Message-----
> > > From: Charles Massey [mailto:CMassey@corp.classmates.com]
> > > Sent: 08 July 2002 16:50
> > > To: 'vmassol@apache.org'
> > > Subject: Cactus - possible bug
> > >
> > > Hi Vincent,
> > >
> > > I came across what might be a possible bug in Cactus.  I am using
a
> > > session
> > > cookie to re-use the session that is created on our application
> > server.  I
> > > receive the JSESSIONID cookie when the session is first created
and
> > pass
> > > it
> > > back in the outgoing request for every subsequent textXXX method
> > calls.
> >
> > How do you do that as there is no order in the tests ? Do you
> > check in a
> > setUp() method if an instance variable (containing) is set and if
so,
> > add a cookie to the request ? Or something like that ?
> >
> > >
> > > The cookie is successfully added to the request in the begin
method.
> > > After
> > > Cactus executes the testXXX method, the second call to the
> > > ServletRedirector
> > > is called to get the result.  When this second call is performed,
> > Cactus
> > > creates a new WebRequest object and the state from the previous
> > WebRequest
> > > initialized in the beginXXX method is not called.  This second
call,
> > to
> > > get
> > > the test result, is what is causing us problems.
> > >
> > > We are using Dynamo and ATG has placed a 20 session limit on our
> > developer
> > > licenses, so that is why it is important to create as
> > little sessions
> > as
> > > possible.
> >
> > Arg! I would never have thought about that!
> >
> > >
> > > The work around that I found to solve this is to edit the
> > > AbstractHttpClient
> > > class and in the callGetResult method, add the cookie to the
request
> > > object
> > > before the post is performed.  I have tested this solution out on
my
> > > machine, and only two sessions are created for the entire test
run.
> > >
> > > I'm not sure if you would consider this a bug, so I thought I
would
> > send
> > > this to you to see what you thought.
> >
> > I would definitely not consider this a bug but more a feature
> > request !
> > :-)
> >
> > However, I would be happy to apply a patch if you submit one ...
> >
> > Thanks
> > -Vincent
> >
> > >
> > > Thanks,
> > > Charley
> >



--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message