Hi Peter,

 

The servlet spec says : "

 

getRequestDispatcher(String)

public RequestDispatcher getRequestDispatcher(java.lang.String path)

Returns a RequestDispatcher object that acts as a wrapper for the
resource located at the given path.

A RequestDispatcher object can be used to forward a request to the
resource or to include the

resource in a response. The resource can be dynamic or static.

The pathname specified may be relative, although it cannot extend
outside the current servlet context. If the

path begins with a "/" it is interpreted as relative to the current
context root. This method returns null if

the servlet container cannot return a RequestDispatcher.

The difference between this method and getRequestDispatcher(String) is
that this method can

take a relative path.

Parameters:

path - a String specifying the pathname to the resource

Returns: a RequestDispatcher object that acts as a wrapper for the
resource at the specified path

See Also: RequestDispatcher, getRequestDispatcher(String)

 

"

 

and thus returning null is perfectly allowed. Thus either your container
returns null or there is a bug with Cactus . :-)

 

1/ Which version of Cactus are you using ?

2/ Are you using the WebRequest.setURL() API. If so, can you send us
what you use?

3/ Can you enable Cactus logging (see the configuration howto guide on
the web site), look for "Computed full path : [ . ]" and give us the
path that is output. Please also give us the "Using simulated PathInfo :
[ ...]" (if any) found just above the previous log and same for "Using
simulated servlet path : [ .]" (if any).

 

Thanks

-Vincent

 

PS: Please post and reply to the Cactus mailing-list. Thanks!

 

-----Original Message-----
From: Peter.Hughes [mailto:[EMAIL PROTECTED]] 
Sent: 14 June 2002 16:31
To: [EMAIL PROTECTED]
Subject: Cactus - request.getRequestDispatcher()

 

Hi Vincent

 

I am trying to Cactus test a servlet within Tomcat which contains the
following code:-

 

                 

....

                       

                       if (("fileDownload").equals(applicationName))

                                              {

                                                          // Forward
request to the file download servlet

 
RequestDispatcher rd = (RequestDispatcher)
request.getRequestDispatcher("download");

 
rd.forward(request, response);

                                              }

                                              else if
(("fileUpload").equals(applicationName))

                                              {

                                                          // File upload

 
RequestDispatcher rd = (RequestDispatcher)
request.getRequestDispatcher("upload");

 
rd.forward(request, response);

                                              }

                                              else if(null ==
applicationName)

                                              {

                                                          // Init
service endpoint Service

 
serviceResponse =

 
ApplicationServiceInvoker.invokeApplicationService(

 
"WelcomeApplication",

 
requestParams,

 
sessionData);

                                              }

 

....

 

 

Whenever I get to   request.getRequestDispatcher()   I get a null
pointer exception (no detail).  I see there is something similar to this
mentioned on the Cactus website Changes page but the hyperlink points to
a different bug than it states and I haven't been able to find anything
in the database or elsewhere on the Web.

 

I would be very grateful for any help if you can spare the time.

 

Cheers

 

Pete Hughes <mailto:[EMAIL PROTECTED]> 


The contents of this email are intended only for the named addressees
and may contain confidential and/or privileged material. If received in
error please contact UPCO on +44 (0) 113 201 0600 and then delete the
entire e-mail from your system. Unauthorised review, distribution,
disclosure or other use of this information could constitute a breach of
confidence. Your co-operation in this matter is greatly appreciated. 

Reply via email to