jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yassen Damyanov ...@media-c.de>
Subject Re: How to setup request paramaters??
Date Fri, 16 Dec 2005 19:28:36 GMT
Kazuhito, Eva -- thank you for your concern!

Kazuhito's recipe worked great for me and now I can test
my servlet :-)

I could also find the samples as he advised me, and they
are very helpful.

I somehow was not able to realize where to look further
reading the official guides. If someone in charge of the
documentation reads this, I suggest adding a small section
at the end, something like "Where to go from here?" with
a reference to the samples.

Thanks again!
Yassen


Kazuhito SUGURI wrote:
> Hi Yassen,
> 
> In article <43A288E3.8020005@media-c.de>,
> Fri, 16 Dec 2005 11:29:07 +0200,
> Yassen Damyanov <yd@media-c.de> wrote: 
> yd> I am trying to test a simple Servlet that gets a GET or POST
> yd> request and bases its work on determining the value of an
> yd> "action" parameter. So I was pretty sure that trying to type
> yd> 
> yd>    request.setParameter(name, value);
> yd> 
> yd> for the Cactus HttpServletRequestWrapper will surely let me
> yd> prepare the request the way I want it (this is in a textXxx()
> yd> context within a ServletTestCase subclass).
> yd> 
> yd> Alas, nothing like that! What do I miss? I cannot imagine that
> yd> there is no way to prepare the request before testing the
> yd> servlet.
> 
> You can do it by using one of WebRequest#addParameter() methods.
> Following is an example:
> 	public void beginXXX(WebRequest theRequest)
> 	{
> 	    theRequest.addParameter("name", "value", WebRequest.POST_METHOD);
> 	}
> 	public void testXXX()
> 	{
> 	    // some tests
> 	}
> 
> You can find working examples archived in the Cactus distribution.
> 
> Hope this helps,
> ----
> Kazuhito SUGURI
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 


Mime
View raw message