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: cactus and velocity?
Date Fri, 30 Nov 2001 21:41:57 GMT

I don't remember seeing anyone else using cactus and velocity on the mailing
list and I don't use velocity myself. Let me still try to help you. I'm not
sure what a velocity servlet is but I imagine it is a standard servlet,
right ? In endXXX, you'll get everything that your servlet write on the
output stream. Your template probably gets applied on the server side and
only the result is sent back to the client (and thus to your endXXX method).
If you'd like to make checks on the server side, you should make them at the
end of your testXXX method. You should be able to get the cookies in the
endXXX method, though.

Is it now working for you ?

----- Original Message -----
From: "Wessels, H" <H.Wessels@t-systems.de>
To: <cactus-user@jakarta.apache.org>
Sent: Friday, November 23, 2001 1:25 PM
Subject: cactus and velocity?

I want to test my velocityServlets with Cactus. From VelocityServlet's
handleRequest I get a Template, but I can't see a way to get it into the
WebResponse for the endXXX function. I did a workaround for only the page
source within testXXX and did my asserts there, but this gives me no access
to cookies etc. I suppose. What is the right way?
Holger (h.wessels@t-systems.de)

---- from testSinglePicture ----
      public void testRequestSinglePicture() {
        SinglePictureServlet picserv = new SinglePictureServlet();
VelocityContext wtcontext=new VelocityContext();
Template result=picserv.handleRequest(request, response, wtcontext);

    public void endRequestSinglePicture(WebResponse theResponse) {
      assertTrue( "Result is empty", "".equals(theResponse.getText()));
---- from SinglePicture ----
public final class SinglePictureServlet extends VelocityServlet {

    public Template handleRequest(HttpServletRequest request,
                      HttpServletResponse response, Context wtcontext)
  Date now = new Date();
  wtcontext.put("name", now.toString());
  Template template=null;
  try {
  template = getTemplate ("singlepicture.vm");
  catch (Exception e)
  System.out.println("error e: "+e.toString());
  return template;

Holger We├čels
T-Systems Nova GmbH
Experte F&E
Goslarer Ufer 35
D-10589 Berlin
Tel.  +49 (030) 3497 -2266
Fax  +49 (030) 3497 -2267
Email  h.wessels@t-systems.de

To unsubscribe, e-mail:
For additional commands, e-mail:

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

View raw message