cziegeler    01/07/20 00:26:53

  Modified:    src/org/apache/cocoon Processor.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        sitemap.xsl
               src/org/apache/cocoon/servlet CocoonServlet.java
  Log:
  When ConnectionResetException occurs, nothing is written to the output stream
  
  Revision  Changes    Path
  1.3       +9 -2      xml-cocoon2/src/org/apache/cocoon/Processor.java
  
  Index: Processor.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Processor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Processor.java    2001/07/09 13:19:48     1.2
  +++ Processor.java    2001/07/20 07:26:53     1.3
  @@ -15,14 +15,21 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.2 $ $Date: 2001/07/09 13:19:48 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/07/20 07:26:53 $
    */
   public interface Processor {
   
       String ROLE = "org.apache.cocoon.Processor";
   
       /**
  -     * Process the given <code>Environment</code> producing the output
  +     * Process the given <code>Environment</code> producing the output.
  +     * @return If the processing is successfull <code>true</code> is returned.
  +     *         If not match is found in the sitemap <code>false</code>
  +     *         is returned.
  +     * @throws ResourceNotFoundException If a sitemap component tries
  +     *                                   to access a resource which can not
  +     *                                   be found, e.g. the generator
  +     *         ConnectionResetException  If the connection was reset
        */
       boolean process(Environment environment)
       throws Exception;
  
  
  
  1.30      +2 -1      
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- sitemap.xsl       2001/07/19 13:36:23     1.29
  +++ sitemap.xsl       2001/07/20 07:26:53     1.30
  @@ -124,7 +124,7 @@
        *
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.29 2001/07/19 13:36:23 bloritsch Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.30 2001/07/20 07:26:53 cziegeler Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, 
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -474,6 +474,7 @@
               </xsl:for-each>
             } catch (ConnectionResetException cre) {
               getLogger().debug("Connection reset by peer");
  +            throw cre;
             } catch (ResourceNotFoundException rse) {
               getLogger().warn("404 Resource Not Found", rse);
               throw rse;
  
  
  
  1.21      +19 -3     xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CocoonServlet.java        2001/07/19 12:20:32     1.20
  +++ CocoonServlet.java        2001/07/20 07:26:53     1.21
  @@ -28,6 +28,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.cocoon.Cocoon;
  +import org.apache.cocoon.ConnectionResetException;
   import org.apache.cocoon.Constants;
   import org.apache.cocoon.Notification;
   import org.apache.cocoon.Notifier;
  @@ -60,7 +61,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.20 $ $Date: 2001/07/19 12:20:32 $
  + * @version CVS $Revision: 1.21 $ $Date: 2001/07/20 07:26:53 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -507,8 +508,7 @@
   
               if (!this.cocoon.process(env)) {
   
  -                // FIXME (NKB) It is not true that !this.cocoon.process(env)
  -                // means only SC_NOT_FOUND
  +                // means SC_NOT_FOUND
                   res.setStatus(res.SC_NOT_FOUND);
   
                   Notification n = new Notification(this);
  @@ -541,6 +541,22 @@
               n.addExtraDescription("path-info", uri);
               // send the notification but don't include it in the output stream
               // as the status SC_NOT_FOUND is enough
  +            res.setContentType(Notifier.notify(n, (OutputStream)null));
  +        } catch (ConnectionResetException cre) {
  +            log.warn("The connection was reset", cre);
  +
  +            Notification n = new Notification(this);
  +            n.setType("resource-not-found");
  +            n.setTitle("Resource not found");
  +            n.setSource("Cocoon servlet");
  +            n.setMessage("Resource not found");
  +            n.setDescription("The requested URI \""
  +                             + request.getRequestURI()
  +                             + "\" was not found.");
  +            n.addExtraDescription("request-uri", request.getRequestURI());
  +            n.addExtraDescription("path-info", uri);
  +            // send the notification but don't include it in the output stream
  +            // as the connection was reset anyway
               res.setContentType(Notifier.notify(n, (OutputStream)null));
           } catch (Exception e) {
               log.error("Problem with servlet", e);
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to