jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank J. Buono" <Frank.Bu...@ExceptionalSoftware.com>
Subject RE: getRequestDispatcher()/JSP Test problem - more...
Date Tue, 28 Jan 2003 13:59:23 GMT
Thanks Vincent:
 
I was about to head down the cactus sample application route when
a colleague hit upon a problem with our use of the WebLogic classloaders.
We resolved the problem, and getRequestDispatcher()/forward() now works
like a champ.
 
Here's the article that helped:
"Making the Most of WebLogic Classloaders",
http://dev2dev.bea.com/articlesnews/discussion/thread.jsp?thread=musser
 
Frank
Hi Frank,

 

Yep. It works for Cactus which has such a test as part of its test suite (which is run everyday
by Gump). You can check the cactus sample application for examples.

 

Note: It seems also quite useful if you set up the java beans used by the JSP in your testXXX()
method. That allows you to isolate the testing of the JSP part from the back end services.

 

-Vincent

 

	-----Original Message----- 
	From: Frank J. Buono 
	Sent: Thu 1/16/2003 12:53 PM 
	To: Cactus Users List 
	Cc: 
	Subject: RE: getRequestDispatcher()/JSP Test problem - more...
	
	
	Hi:
	 
	From looking at the code (below), I'm wondering if the problem
	is in  the way forward() handles "theRequest"?    "theResponse"
	is passed through; however, request.getOriginalRequest()
	is passed as the request.
	 
	Since I'm a Cactus/WebLogic newbie, I'm grasping at air at this point...
	 
	Thanks.
	 
	Frank
	 
	RequestDispatcherWrapper.java:
	 
	 /**
	     * Call the original <code>RequestDispatcher</code> <code>forward()</code>
	     * method but with the original HTTP request (not the simulation one which
	     * would make the servlet engine choke !).
	     *
	     * @param theRequest the simulation HTTP request
	     * @param theResponse the original HTTP response
	     * @exception IOException {@link RequestDispatcher#forward}
	     * @exception ServletException {@link RequestDispatcher#forward}
	     */
	    public void forward(ServletRequest theRequest, ServletResponse theResponse)
	        throws IOException, ServletException
	    {
	        HttpServletRequestWrapper request =
	            (HttpServletRequestWrapper) theRequest;
	        this.originalDispatcher.forward(request.getOriginalRequest(),
	            theResponse);
	    }
	 

		-----Original Message----- 
		From: Frank J. Buono 
		Sent: Wed 1/15/2003 10:43 AM 
		To: Frank J. Buono; cactus-user@jakarta.apache.org 
		Cc: 
		Subject: getRequestDispatcher()/JSP Test problem
		
		

		Hi:
		
		I've got the getRequestDispathcher() and forward() methods working; however,
		the .jsp file can't find (load) the beans it references. HTML is returned, as expected,
		in endXXX() from the .jsp file.
		
		Per the output (below) it appears that port # and URL are wrong in the request
		to the JSP - it's getting port 80; we're using port 7001...
		
		We're using weblogic 7.0 and the ServletTestRunner.
		
		Is this a configuration problem?
		
		Thanks.
		
		Frank
		
		
		public void testFrank() throws java.io.IOException, ServletException
		    {
		           System.out.println ( "CACTUS_CONTEXT_URL_PROPERTY: " +
		           System.getProperty (Configuration.CACTUS_CONTEXT_URL_PROPERTY ) );
		     
		           RequestDispatcher rd =
		           config.getServletContext().getRequestDispatcher(
		           "/jsp/weSimpleXmlQueryWithTest.jsp?selectClause=sysdate&fromClause=dual");
		
		           System.out.println ( "path: " + request.getRequestURL() );
		           rd.forward(request, response);
		
		    }
		
		     public void endFrank(WebResponse webResponse)
		    {
		           WebRequest wr = webResponse.getWebRequest();
		            System.out.println ( "wr: " + wr );
		            System.out.println("   IN endFrank***: " + webResponse.getText());
		            assertEquals("we're in!", "we're in!");
		    }
		
		*** Output from our test servlet
		CACTUS_CONTEXT_URL_PROPERTY: http://john2:7001/WeSimpleQuery
		ServletContext.getServerInfo: WebLogic WebLogic Server 7.0 SP1 
		                              Mon Sep 9 22:46:58 PDT 2002 206753
		request.getRequestURL: http://john2:80/WeSimpleQuerynullnull
		
		*** Output from our JSP
		***
		JSP:request.getServerPort: 80
		JSP:request.getURL: http://john2:80/WeSimpleQuery/jsp/weSimpleXmlQueryWithTest.jsp
		
		
		
		
		

Mime
View raw message