> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> list-help: <mailto:[EMAIL PROTECTED]>
> list-unsubscribe: <mailto:[EMAIL PROTECTED]>
> list-post: <mailto:[EMAIL PROTECTED]>
> Delivered-To: mailing list [EMAIL PROTECTED]
> From: BugRat Mail System <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: BugRat Report #543 has been filed.
> X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N
> 
> Bug report #543 has just been filed.
> 
> You can view the report at the following URL:
> 
>    <http://znutar.cortexity.com/BugRatViewer/ShowReport/543>
> 
> REPORT #543 Details.
> 
> Project: Tomcat
> Category: Bug Report
> SubCategory: New Bug Report
> Class: swbug
> State: received
> Priority: high
> Severity: critical
> Confidence: public
> Environment: 
>    Release: 3.2 Final
>    JVM Release: Sun JDK 1.3.0-C
>    Operating System: NT4
>    OS Release: SP5
>    Platform: intel
> 
> Synopsis: 
> calling getServletContext().getRequestDispatcher() always returns null
> 
> Description:
> Making a call to:
> getServletContext().getRequestDispatcher("http://www.google.com/")
> 
> with any string, always returns null;

Follows the javadoc for getRequestDispatcher().

What can be seen is that it explicitly says that the path must
begin with a "/", and your usage does not.

The javadoc does not say that you can pass any URL as an argument.

>From the implementation perspective, if what you want to do is
perform a redirection to a URL outside your tomcat servlet container,
RequestDispatcher redirection is not what you need to do.
You should probably do location redirect.

        response.setHeader("Location", url);
        

Here is the javadoc.


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 must begin with a "/" and is interpreted as relative to the current
     context root. Use getContext to obtain a RequestDispatcher for resources in
     foreign contexts. This method returns null if the ServletContext cannot return a
     RequestDispatcher.
     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, getContext(java.lang.String)


Arieh
--
 Arieh Markel                           Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: [EMAIL PROTECTED]           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)

Reply via email to