tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Proposal - Comet changes
Date Fri, 11 Aug 2006 16:37:38 GMT
Gents,
I have a suggestion on a small refactor for the CometProcessor, mainly 
to make it a little bit more flexible,
here are my suggestions

1. public void begin(HttpServletRequest request, HttpServletResponse 
response)
Suggestion - remove this method, its never called from the container 
anyway, so there is no need to require the implementation

2. public void end(HttpServletRequest request, HttpServletResponse response)
Suggestion - remove this method, its never called from the container, 
same logic as above

3. public boolean read(HttpServletRequest request, HttpServletResponse 
response)
Suggestion - change this method to
  
   public boolean event(CometEvent event)
   This will allow the container to implement notifications for 
timeouts, socket close, and read events through a single channel.
   Easier to add future events and/or more fine grained events

4. public boolean error(HttpServletRequest request, HttpServletResponse 
response)
Suggestion - remove this method, as it can be replaced with the event 
method.
If we do want to keep this method, lets include a little bit more info 
about the error, is it a timeout or a socket close, or an in process 
exception etc

5. CometEvent

public class CometEvent {
   public enum EventType {
     
READ,TIMEOUT,SOCKET_CLOSE,CONTAINER_SHUTDOWN,CONTEXT_SHUTDOWN,GENERIC_ERROR 
//and anything else, we could also create groups of types, 
READ,ERROR,SHUTDOWN, with subtypes
   }

   public HttpServletRequest getRequest();
   public HttpServletResponse getResponse();
   ...and other useful info here
}

I believe this would allow for more flexibility in the future and a 
cleaner interface.
The CometServlet can actually stay exactly the same, if need be, as the 
begin,end methods can be called based on service() and event()

Filip


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message