KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > sandesha > interop > testclient > ResponseWriter


1 package org.apache.sandesha.interop.testclient;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5
6 import java.io.PrintWriter JavaDoc;
7
8
9 /**
10  * @author root
11  * <p/>
12  * To change the template for this generated type comment go to
13  * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
14  */

15 public class ResponseWriter {
16
17     private PrintWriter JavaDoc writer;
18     private static final Log log = LogFactory.getLog(PrintWriter JavaDoc.class.getName());
19
20     public ResponseWriter(PrintWriter JavaDoc writer) {
21         this.writer = writer;
22     }
23
24     public synchronized boolean write(String JavaDoc s) {
25         try {
26             writer.println(s);
27             flush();
28             return true;
29         } catch (Exception JavaDoc e) {
30             log.error("Exception: In method 'write' of 'ResponseWriter");
31             return false;
32         }
33     }
34
35     public synchronized void flush() {
36         writer.flush();
37     }
38 }
39
Popular Tags