20030715 Tuesday July 15, 2003

Upgrading to latest WebTest and Cactus I attempted (and succeeded) in upgrading to the latest and greatest releases of Canoo's WebTest and Jakarta's Cactus this afternoon. It wasn't too bad. Both have revised their taskdef's to read from a properties file, and Cactus has simplified the process to include cactus-related JARs/mappings in your webapps. Now you can "cactify" your war with a little Ant-lovin:

<cactifywar srcfile="${webapp.dist}/${webapp.war}"
    destfile="${webapp.dist}/${webapp.name}-cactus.war">
    <lib dir="${strutstestcase.dir}" includes="*.jar"/>
    <lib dir="${cactus.dir}">
        <include name="*.jar"/>
    </lib>
</cactifywar>

Pretty slick IMO. Now if I could only figure out how to do form-based authentication with Cactus (I couldn't find it in the docs).

The other issue I've been banging my head against the wall over is running canoo/httpunit tests with a compression filter enabled. Yep, the problems still exist, despite the fact that I patched httpunit. So I've come up with a new fix that satisfies me and eases the pain in my noggin'. In my compression filter, I simply disabled compression when it's an httpunit test:

String userAgent = req.getHeader("User-Agent");
if (!isGzipSupported(req) || userAgent.startsWith("httpunit")) {
    // Invoke resource normally.
    chain.doFilter(req, res);
} else { 
    // gzip it
}

Posted in Java at Jul 15 2003, 07:05:36 PM MDT 2 Comments

Comments:

Hi Matt, If you know how to do BASIC authentication with Cactus then doing Form-based is easy. Try using http://jakarta.apache.org/cactus/writing/howto_security.html to get you started and post any question to the mailing list. I'm glad your upgrade went ok :-) Thanks -Vincent

Posted by Vincent Massol on July 15, 2003 at 11:09 PM MDT #

Awesome - that worked! And it was <em>very</em> simple to get working. Now the question is - can I put this in in a base class for all my Actions (extends CactusStrutsTestCase)? I'd love to have a setup where each Test class can call super.authenticate() and it authenticates using the following lines:

theRequest.setRedirectorName("ServletRedirectorSecure");
theRequest.setAuthentication(new FormAuthentication("tomcat", "tomcat"));

Posted by Matt Raible on July 18, 2003 at 08:23 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architecture Consultant specializing in open source frameworks.
« May 2012
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
23
24
25
26
27
28
29
30
31
  
       
Today

Recent Entries

Tag Cloud