1 4 package nl.justobjects.pushlet.core; 5 6 import javax.servlet.http.HttpServletResponse ; 7 import java.io.IOException ; 8 import java.io.ObjectOutputStream ; 9 10 20 class SerializedAdapter implements ClientAdapter { 21 private ObjectOutputStream out = null; 22 public static final String CONTENT_TYPE = "application/x-java-serialized-object"; 23 private HttpServletResponse servletRsp; 24 25 26 public SerializedAdapter(HttpServletResponse aServletResponse) { 27 servletRsp = aServletResponse; 28 } 29 30 public void start() throws IOException { 31 32 servletRsp.setContentType(CONTENT_TYPE); 33 34 out = new ObjectOutputStream (servletRsp.getOutputStream()); 36 37 servletRsp = null; 39 } 40 41 42 public void push(Event anEvent) throws IOException { 43 out.writeObject(anEvent); 44 45 out.flush(); 46 } 47 48 49 public void stop() throws IOException { 50 } 51 } 52 53 93 | Popular Tags |