1 4 package nl.justobjects.pushlet.core; 5 6 import nl.justobjects.pushlet.util.Log; 7 8 import javax.servlet.ServletOutputStream ; 9 import javax.servlet.http.HttpServletResponse ; 10 import java.io.IOException ; 11 12 18 class XMLAdapter implements ClientAdapter { 19 private ServletOutputStream out = null; 20 private HttpServletResponse servletRsp; 21 22 23 public XMLAdapter(HttpServletResponse aServletResponse) { 24 servletRsp = aServletResponse; 25 } 26 27 public void start() throws IOException { 28 29 servletRsp.setContentType("text/plain"); 34 35 out = servletRsp.getOutputStream(); 36 37 servletRsp = null; 39 40 } 41 42 43 public void push(Event anEvent) throws IOException { 44 debug("event=" + anEvent); 45 46 out.print(anEvent.toXML()); 48 out.flush(); 49 } 50 51 52 public void stop() throws IOException { 53 } 54 55 private void debug(String s) { 56 Log.debug("[XMLAdapter]" + s); 57 } 58 } 59 60 92 | Popular Tags |