tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java
Date Fri, 06 Oct 2000 00:47:17 GMT
craigmcc    00/10/05 17:47:17

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  Teach the default file-serving servlet to check the request attributes for
  the path information to the included file, when we are processing inside a
  RequestDispatcher.include.
  
  Revision  Changes    Path
  1.8       +18 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultServlet.java	2000/10/05 21:11:25	1.7
  +++ DefaultServlet.java	2000/10/06 00:47:17	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.7 2000/10/05 21:11:25 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/10/05 21:11:25 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.8 2000/10/06 00:47:17 craigmcc Exp $
  + * $Revision: 1.8 $
  + * $Date: 2000/10/06 00:47:17 $
    *
    * ====================================================================
    *
  @@ -112,7 +112,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.7 $ $Date: 2000/10/05 21:11:25 $
  + * @version $Revision: 1.8 $ $Date: 2000/10/06 00:47:17 $
    */
   
   public class DefaultServlet
  @@ -286,6 +286,19 @@
        */
       protected String getRelativePath(HttpServletRequest request) {
           
  +        // Are we being processed by a RequestDispatcher.include()?
  +        if (request.getAttribute("javax.servlet.include.request_uri")!=null) {
  +            String result = (String)
  +                request.getAttribute("javax.servlet.include.path_info");
  +            if (result == null)
  +                result = (String)
  +                    request.getAttribute("javax.servlet.include.servlet_path");
  +            if ((result == null) || (result.equals("")))
  +                result = "/";
  +            return (result);
  +        }
  +
  +        // No, extract the desired path directly from the request
           String result = request.getPathInfo();
           if (result == null) {
               result = request.getServletPath();
  @@ -1288,7 +1301,7 @@
               
               try {
                   ostream = response.getOutputStream();
  -            } catch (IllegalArgumentException e) {
  +            } catch (IllegalStateException e) {
                   // If it fails, we try to get a Writer instead if we're 
                   // trying to serve a text file
                   if ( (contentType != null) 
  
  
  

Mime
View raw message