File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes servlet forwarding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "servlet forwarding" Watch "servlet forwarding" New topic
Author

servlet forwarding

Kris Smith
Greenhorn

Joined: Nov 18, 2005
Posts: 8
Hi everyone again got another question for you guys. What im ultimatly trying to do is run integration style tests on an oracle application server. I have everything running currently but im haveing some problems with testing more complex J2EE components. So here i go..

What i have is effectivly 2 .war files, 1 with that has servlet /testing and a JUnitEE one that has a /runtests servlet. Now what im trying to do is run a cactus test from my /runtests that uses getRequestDispatcher() to try to forward the httprequest and httpresponse to the /testing servlet in the other war file. This is just to make sure everything links up ok and this will allow me to test it in an automated fashion. Now the problem im haveing is that i keep getting null back from /testing instead of a link wrapper to the actual servlet. The code looks as follows.

sorry for messy code in display but i cant format very well in here Now i always get a null back and from other posts this seems like it should work. Is the problem with trying to call a dispatcher from cactus? am i doing something fundementally retarded that i should know about? Is there a better way to do this kind of integration test? Any input would rock thanks a bunch

Kris
[ December 03, 2005: Message edited by: Lasse Koskela ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hi Kris,

I don't think I can help with your problem but I have cleaned up your formatting. The key is to use UBB codes (and spaces instead of tabs--much easier to deal with).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kris Smith
Greenhorn

Joined: Nov 18, 2005
Posts: 8
Alright found the solution. The problem was trying to communicate between different contexts. I combined the war files and was able to use the above code fine. Also cactus seems to work fine with the spring framework if anyone was curious about that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet forwarding