> -----Original Message-----
> From: Gunnar Ole Skogen [mailto:[EMAIL PROTECTED]]
> Sent: 18 March 2002 12:00
> To: Cactus Users List
> Subject: RE: Context environment vars in tested servlet
> 
> Vincent,
> 
> Allready in the docs : sorry,  I did not check.
> Where in the docs :Probably in a checklist of what to do and what not
to
> do
> : If I eventually write something in the Programmers handbook for the
> project I am involved in I will submit this to you so you can use
whole or
> part if useful ( my time now is sparse )

cool ! We're eagerly waiting ... :-)

> 
> Wish I had time to help, if I get any I will.
> 
> Thanks
> 
> Gunnar

Thanks for participating.
-Vincent

> 
> -----Original Message-----
> From: Vincent Massol [mailto:[EMAIL PROTECTED]]
> Sent: 15. mars 2002 20:06
> To: 'Cactus Users List'
> Subject: RE: Context environment vars in tested servlet
> 
> 
> Hi Gunnar,
> 
> > -----Original Message-----
> > From: Gunnar Ole Skogen [mailto:[EMAIL PROTECTED]]
> > Sent: 28 February 2002 07:09
> > To: [EMAIL PROTECTED]
> > Subject: Context environment vars in tested servlet
> >
> > Hi,
> > No big deal , but:
> > The servlet I am testing with Cactus has environment variables in
its
> > war's
> > web.xml.
> > These are not awailable to it when testing from Cactus.
> > I guess this is because the ServletRedirector runs the Servlet class
> to be
> > tested itself ?
> 
> yes.
> 
> > A warning about this in the docs is probably in place ?
> 
> I thought is was there ... :-). In what location in the Cactus
> documentation would you like to see this warning ? Could you submit a
> patch ? :-)
> 
> > Possibilities to get around this:
> > 1) Put the env vars into the war of the ServletRedirector : -
> complicates
> > my
> > ant build with xsl transform etc....
> > 2) Argue that a servlet should not do processing needing such : ) ->
:
> > 3) Put the env vars in a more global place : - Bad design solution
> when
> > these are only needed in one place
> 
> 4) Put the environment variables under the ServletRedirector's
> definition in web.xml (officially recommended way in Cactus)
> 
> 5) If you need to have the same parameters and different values or if
> you want to separate per test case, have several entries for the
> ServletRedirector in web.xml. Ex:
> 
>     <servlet>
>         <servlet-name>ServletRedirector</servlet-name>
> 
>
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-c
> lass>
>         <init-param>
>           <param-name>param1</param-name>
>           <param-value>value1 used for testing</param-value>
>         </init-param>
>     </servlet>
> 
>     <servlet>
>         <servlet-name>ServletRedirector_TestOverride</servlet-name>
> 
>
<servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-c
> lass>
>         <init-param>
>           <param-name>param2</param-name>
>           <param-value>value2 used for testing</param-value>
>         </init-param>
>     </servlet>
> 
> and the in your test case :
> 
>     public void beginRedirectorOverride(WebRequest theRequest)
>     {
>         theRequest.setRedirectorName("ServletRedirectorOverride");
>     }
> 
> , the default being to use the redirector defined in
cactus.properties.
> 
> -Vincent
> 
> P.S. 1: This subject has been previously discussed on this
mailing-list
> and we haven't found yet a good solution to it.
> 
> P.S. 2: One other solution would be to get rid of the Cactus
redirector
> and instead intercept the real servlet's service() method. This is
> possible using several technologies like BCEL, AspectJ, etc. This is a
> research area I am working on (albeit very slowly). If you wish to
help,
> you are very welcome to join us ! :-)
> 
> Thanks
> 
> >
> >
> > - Gunnar Skogen
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > [EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:cactus-user-
> > [EMAIL PROTECTED]>
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:cactus-user-
> [EMAIL PROTECTED]>
> 




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to