cziegeler 01/07/19 05:20:49
Modified: src/org/apache/cocoon Tag: cocoon_20_branch Notifier.java
src/org/apache/cocoon/servlet Tag: cocoon_20_branch
CocoonServlet.java
Log:
When the http status RC_NOT_FOUND is set, nothing is written to the output
Revision Changes Path
No revision
No revision
1.2.2.1 +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.2.2.1
diff -u -r1.2 -r1.2.2.1
--- Notifier.java 2001/05/31 17:37:33 1.2
+++ Notifier.java 2001/07/19 12:20:49 1.2.2.1
@@ -24,7 +24,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 17:37:33 $
+ * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/07/19 12:20:49 $
*/
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";
No revision
No revision
1.13.2.7 +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.13.2.6
retrieving revision 1.13.2.7
diff -u -r1.13.2.6 -r1.13.2.7
--- CocoonServlet.java 2001/07/18 10:44:39 1.13.2.6
+++ CocoonServlet.java 2001/07/19 12:20:49 1.13.2.7
@@ -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:[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.13.2.6 $ $Date: 2001/07/18 10:44:39 $
+ * @version CVS $Revision: 1.13.2.7 $ $Date: 2001/07/19 12:20:49 $
*/
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: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]