tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Date Wed, 24 Apr 2002 11:58:01 GMT
remm        02/04/24 04:58:00

  Modified:    jasper2/src/share/org/apache/jasper/resources
                        messages.properties
               jasper2/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  - Fix bug 7575.
  - Jasper now keeps track of the availability status of each individual JSP page.
  
  Revision  Changes    Path
  1.2       +2 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- messages.properties	28 Mar 2002 18:46:19 -0000	1.1
  +++ messages.properties	24 Apr 2002 11:58:00 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: messages.properties,v 1.1 2002/03/28 18:46:19 kinman Exp $
  +# $Id: messages.properties,v 1.2 2002/04/24 11:58:00 remm Exp $
   #
   # Default localized string information
   # Localized this the Default Locale as is en_US
  @@ -22,6 +22,7 @@
   jsp.error.not.impl.plugin=Internal error: plugin not implemented
   jsp.error.not.impl.forward=Internal error: forward not implemented
   jsp.error.not.impl.include=Internal error: include not implemented
  +jsp.error.unavailable=JSP has been marked unavailable
   jsp.error.usebean.missing.attribute=useBean: id attribute missing or misspelled
   jsp.error.usebean.missing.type=useBean ({0}): Either class or type attribute must be \
   specified: 
  
  
  
  1.4       +28 -0     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/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	24 Apr 2002 02:21:05 -0000	1.3
  +++ JspServlet.java	24 Apr 2002 11:58:00 -0000	1.4
  @@ -60,6 +60,7 @@
   import javax.servlet.ServletConfig;
   import javax.servlet.ServletException;
   import javax.servlet.SingleThreadModel;
  +import javax.servlet.UnavailableException;
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  @@ -127,6 +128,7 @@
   	URLClassLoader loader = null;
           JspCompilationContext ctxt = null;
           String outDir = null;
  +        long available = 0L;
   	
   	JspServletWrapper(String jspUri, boolean isErrorPage) {
   	    this.jspUri = jspUri;
  @@ -203,6 +205,14 @@
   	    throws ServletException, IOException, FileNotFoundException 
   	{
               try {
  +
  +                if ((available > 0L) && (available < Long.MAX_VALUE)) {
  +                    response.setDateHeader("Retry-After", available);
  +                    response.sendError
  +                        (HttpServletResponse.SC_SERVICE_UNAVAILABLE,
  +                         Constants.getString("jsp.error.unavailable"));
  +                }
  +
                   loadIfNecessary(request, response);
   
   		// If a page is to only to be precompiled return.
  @@ -219,6 +229,24 @@
   		    theServlet.service(request, response);
   		}
   
  +            } catch (UnavailableException ex) {
  +                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 ex;
  +                } else {
  +                    int unavailableSeconds = ex.getUnavailableSeconds();
  +                    if (unavailableSeconds <= 0)
  +                        unavailableSeconds = 60;        // Arbitrary default
  +                    available = System.currentTimeMillis() +
  +                        (unavailableSeconds * 1000L);
  +                    response.sendError
  +                        (HttpServletResponse.SC_SERVICE_UNAVAILABLE, 
  +                         ex.getMessage());
  +		}
               } catch (FileNotFoundException ex) {
                   String includeRequestUri = (String)
                       request.getAttribute("javax.servlet.include.request_uri");
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message