Menu

#11 Make setRequestPathInfo optional in CactusStrutsTestCase

open
nobody
None
5
2003-07-11
2003-07-11
No

When using Cactus it is common to use a beginXXX method
to set up
request parameters and other things, among them the
pathInfo for
the request on the server side.

If you do so, request.getPathInfo() returns the correct
value inside the
testXXX, but you still have to invoke
setRequestPathInfo (redundantly
as it seems) before you can invoke actionPerform.

The reason is that getActionServlet will
unconditionally access
request.getAttribute(Common.INCLUDE_SERVLET_PATH)
which has not been set unless you invoke
setRequestPathInfo, resulting
in an NPE.

One solution would be to invoke setRequestPathInfo in
CactusStrutsTestCase#setUp if the request provided by
Cactus
already contains the path info.

I think this forum entry here
http://sourceforge.net/forum/forum.php?thread_id=894124&forum_id=121751
points at the same problem, I may be wrong.

As the docs say that you must invoke
setRequestPathInfo, I'm filing
this as an enhancement request and not a bug (even
though a null
check in CactusSTC line 415 may be a good idea anyway).

Discussion


Log in to post a comment.