cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/servlet CocoonServlet.java
Date Fri, 20 Apr 2001 07:16:21 GMT
cziegeler    01/04/20 00:16:20

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Notifier.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Removed dependencies to javax.servlet package
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +14 -13    xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java
  
  Index: Notifier.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- Notifier.java	2001/04/02 11:49:42	1.1.2.9
  +++ Notifier.java	2001/04/20 07:16:09	1.1.2.10
  @@ -14,14 +14,9 @@
   
   import java.text.DateFormat;
   
  -import java.io.PrintStream;
   import java.io.IOException;
  -import java.io.PrintWriter;
  +import java.io.OutputStream;
   
  -import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpServletResponse;
  -import javax.servlet.ServletOutputStream;
  -
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
   import org.xml.sax.Attributes;
  @@ -32,21 +27,24 @@
    *
    * @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.1.2.9 $ $Date: 2001/04/02 11:49:42 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/04/20 07:16:09 $
    */
   
   public class Notifier {
   
       /**
  -     * Generate notification information as servlet response
  +     * Generate notification information as a response.
  +     * 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
  +     * @return The content type for this notification
  +     *         (currently always text/html)
        */
  -    public static void notify(Notificable n, HttpServletRequest req, HttpServletResponse
res) throws IOException {
  +    public static String notify(Notificable n, OutputStream outputStream)
  +    throws IOException {
   
           StringBuffer sb = new StringBuffer();
   
  -        // FIXME (SM) how can we send the error with the proper content type?
  -
  -        res.setContentType("text/html");
           sb.append("<html><head><title>").append(n.getTitle()).append("</title>");
           sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color :
white;background-color : #0086b2;} ");
           sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color
: white;} ");
  @@ -73,8 +71,11 @@
   
           sb.append("<HR size=\"1\" noshade>");
           sb.append("</body></html>");
  +
  +        outputStream.write(sb.toString().getBytes());
  +        // FIXME (SM) how can we send the error with the proper content type?
   
  -        res.getOutputStream().print(sb.toString());
  +        return "text/html";
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.83  +5 -5      xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.82
  retrieving revision 1.1.4.83
  diff -u -r1.1.4.82 -r1.1.4.83
  --- CocoonServlet.java	2001/04/19 19:05:23	1.1.4.82
  +++ CocoonServlet.java	2001/04/20 07:16:16	1.1.4.83
  @@ -63,7 +63,7 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.82 $ $Date: 2001/04/19 19:05:23 $
  + * @version CVS $Revision: 1.1.4.83 $ $Date: 2001/04/20 07:16:16 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -390,7 +390,7 @@
               n.setMessage("Internal servlet error");
               n.setDescription("Cocoon was not initialized.");
               n.addExtraDescription("request-uri", request.getRequestURI());
  -            Notifier.notify(n, request, res);
  +            res.setContentType(Notifier.notify(n, res.getOutputStream()));;
   
               return;
           }
  @@ -439,7 +439,7 @@
                                    + "\" was not found.");
                   n.addExtraDescription("request-uri", request.getRequestURI());
                   n.addExtraDescription("path-info", uri);
  -                Notifier.notify(n, request, res);
  +                res.setContentType(Notifier.notify(n, res.getOutputStream()));;
               }
           } catch (ResourceNotFoundException rse) {
               log.warn("The resource was not found", rse);
  @@ -455,7 +455,7 @@
                                + "\" was not found.");
               n.addExtraDescription("request-uri", request.getRequestURI());
               n.addExtraDescription("path-info", uri);
  -            Notifier.notify(n, request, res);
  +            res.setContentType(Notifier.notify(n, res.getOutputStream()));;
           } catch (Exception e) {
               log.error("Problem with servlet", e);
               //res.setStatus(res.SC_INTERNAL_SERVER_ERROR);
  @@ -465,7 +465,7 @@
               n.setSource("Cocoon servlet");
               n.addExtraDescription("request-uri", request.getRequestURI());
               n.addExtraDescription("path-info", uri);
  -            Notifier.notify(n, request, res);
  +            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