1 17 18 19 package org.apache.catalina.connector; 20 21 import java.io.IOException ; 22 23 import javax.servlet.ServletException ; 24 import javax.servlet.http.HttpServletRequest ; 25 import javax.servlet.http.HttpServletResponse ; 26 27 import org.apache.catalina.CometEvent; 28 29 public class CometEventImpl implements CometEvent { 30 31 32 public CometEventImpl(Request request, Response response) { 33 this.request = request; 34 this.response = response; 35 } 36 37 38 40 41 44 protected Request request = null; 45 46 47 50 protected Response response = null; 51 52 53 56 protected EventType eventType = EventType.BEGIN; 57 58 59 62 protected EventSubType eventSubType = null; 63 64 65 67 70 public void clear() { 71 request = null; 72 response = null; 73 } 74 75 public void setEventType(EventType eventType) { 76 this.eventType = eventType; 77 } 78 79 public void setEventSubType(EventSubType eventSubType) { 80 this.eventSubType = eventSubType; 81 } 82 83 public void close() throws IOException { 84 request.setComet(false); 85 response.finishResponse(); 86 } 87 88 public EventSubType getEventSubType() { 89 return eventSubType; 90 } 91 92 public EventType getEventType() { 93 return eventType; 94 } 95 96 public HttpServletRequest getHttpServletRequest() { 97 return request.getRequest(); 98 } 99 100 public HttpServletResponse getHttpServletResponse() { 101 return response.getResponse(); 102 } 103 104 public void setTimeout(int timeout) throws IOException , ServletException , 105 UnsupportedOperationException { 106 if (request.getAttribute("org.apache.tomcat.comet.timeout.support") == Boolean.TRUE) { 107 request.setAttribute("org.apache.tomcat.comet.timeout", new Integer (timeout)); 108 } else { 109 throw new UnsupportedOperationException (); 110 } 111 } 112 113 } 114 | Popular Tags |