tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pier...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java
Date Mon, 09 Oct 2000 21:47:30 GMT
pierred     00/10/09 14:47:30

  Modified:    jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  An included page that does not exist will now return an exception
  instead of trying to call sendError(404), since the sendError
  is ignored for an included servlet.
  
  Revision  Changes    Path
  1.4       +21 -12    jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspServlet.java	2000/10/05 23:40:38	1.3
  +++ JspServlet.java	2000/10/09 21:47:29	1.4
  @@ -181,19 +181,28 @@
   		}
   
               } catch (FileNotFoundException ex) {
  -		try {
  -		    response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  -				       ex.getMessage());
  -		} catch (IllegalStateException ise) {
  -		    Constants.jasperLog.log(Constants.getString
  -					    ("jsp.error.file.not.found",
  -					     new Object[] {
  -						 ex.getMessage()
  -					     }), ex,
  -					    Logger.ERROR);
  +                String includeRequestUri = (String)
  +                    request.getAttribute("javax.servlet.include.request_uri");
  +                if (includeRequestUri != null) {
  +                    // This file was included. Throw an exception as
  +                    // a response.sendError() will be ignored by the
  +                    // servlet engine.
  +                    throw new ServletException(ex);
  +                } else {
  +                    try {
  +			response.sendError(HttpServletResponse.SC_NOT_FOUND, 
  +					   ex.getMessage());
  +		    } catch (IllegalStateException ise) {
  +			Constants.jasperLog.log(Constants.getString
  +						("jsp.error.file.not.found",
  +						 new Object[] {
  +						     ex.getMessage()
  +						 }), ex,
  +						Logger.ERROR);
  +		    }
  +		    return;
   		}
  -                return;
  -            }
  +	    }
   	}
   
   	public void destroy() {
  
  
  

Mime
View raw message