cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/servlet CocoonServlet.java
Date Thu, 19 Jul 2001 12:20:32 GMT
cziegeler    01/07/19 05:20:32

  Modified:    src/org/apache/cocoon Notifier.java
               src/org/apache/cocoon/servlet CocoonServlet.java
  Log:
  When the http status RC_NOT_FOUND is set, nothing is written to the output
  
  Revision  Changes    Path
  1.3       +3 -2      xml-cocoon2/src/org/apache/cocoon/Notifier.java
  
  Index: Notifier.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Notifier.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Notifier.java	2001/05/31 17:37:33	1.2
  +++ Notifier.java	2001/07/19 12:20:32	1.3
  @@ -24,7 +24,7 @@
    *
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 17:37:33 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/07/19 12:20:32 $
    */
   
   public class Notifier {
  @@ -34,6 +34,7 @@
        * The notification is directly written to the OutputStream.
        * @param  n The <code>Notificable</code> object
        * @param outputStream The output stream the notification is written to
  +     *        This could be <code>null</code>.
        * @return The content type for this notification
        *         (currently always text/html)
        */
  @@ -69,7 +70,7 @@
           sb.append("<HR size=\"1\" noshade>");
           sb.append("</body></html>");
   
  -        outputStream.write(sb.toString().getBytes());
  +        if (outputStream != null) outputStream.write(sb.toString().getBytes());
           // FIXME (SM) how can we send the error with the proper content type?
   
           return "text/html";
  
  
  
  1.20      +9 -4      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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CocoonServlet.java	2001/07/18 10:44:26	1.19
  +++ CocoonServlet.java	2001/07/19 12:20:32	1.20
  @@ -9,6 +9,7 @@
   
   import java.io.File;
   import java.io.IOException;
  +import java.io.OutputStream;
   import java.io.PrintWriter;
   import java.net.MalformedURLException;
   import java.net.URL;
  @@ -59,7 +60,7 @@
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.19 $ $Date: 2001/07/18 10:44:26 $
  + * @version CVS $Revision: 1.20 $ $Date: 2001/07/19 12:20:32 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -520,7 +521,9 @@
                                    + "\" was not found.");
                   n.addExtraDescription("request-uri", request.getRequestURI());
                   n.addExtraDescription("path-info", uri);
  -                res.setContentType(Notifier.notify(n, res.getOutputStream()));;
  +                // 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 (ResourceNotFoundException rse) {
               log.warn("The resource was not found", rse);
  @@ -536,7 +539,9 @@
                                + "\" was not found.");
               n.addExtraDescription("request-uri", request.getRequestURI());
               n.addExtraDescription("path-info", uri);
  -            res.setContentType(Notifier.notify(n, res.getOutputStream()));;
  +            // 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 (Exception e) {
               log.error("Problem with servlet", e);
               //res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
  @@ -546,7 +551,7 @@
               n.setSource("Cocoon servlet");
               n.addExtraDescription("request-uri", request.getRequestURI());
               n.addExtraDescription("path-info", uri);
  -            res.setContentType(Notifier.notify(n, res.getOutputStream()));;
  +            res.setContentType(Notifier.notify(n, res.getOutputStream()));
           }
   
           ServletOutputStream out = res.getOutputStream();
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message