Author: remy.maucherat(a)jboss.com
Date: 2008-07-04 04:36:15 -0400 (Fri, 04 Jul 2008)
New Revision: 699
Added:
trunk/java/org/apache/catalina/connector/HttpEventImpl.java
Removed:
trunk/java/org/apache/catalina/connector/CometEventImpl.java
trunk/java/org/jboss/web/comet/
Modified:
trunk/build.xml
trunk/java/org/apache/catalina/Valve.java
trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
trunk/java/org/apache/catalina/core/StandardContextValve.java
trunk/java/org/apache/catalina/core/StandardEngineValve.java
trunk/java/org/apache/catalina/core/StandardHostValve.java
trunk/java/org/apache/catalina/core/StandardWrapperValve.java
trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
trunk/java/org/apache/catalina/valves/ValveBase.java
trunk/java/org/jboss/servlet/http/HttpEvent.java
trunk/webapps/docs/aio.xml
trunk/webapps/docs/changelog.xml
Log:
- Rename Comet API to be more clear that it is a separate Servlet type (which could use a
few direct
hooks in the core HttpServlet API, but this is not doable at the moment).
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-07-04 07:48:40 UTC (rev 698)
+++ trunk/build.xml 2008-07-04 08:36:15 UTC (rev 699)
@@ -208,8 +208,8 @@
<fileset dir="${tomcat.classes}">
<include name="org/apache/*" />
<include name="org/apache/catalina/**" />
- <include name="org/apache/comet/**" />
<include name="org/apache/naming/**" />
+ <include name="org/jboss/servlet/http/**" />
<include name="org/jboss/web/**" />
<!-- Javadoc and i18n exclusions -->
<exclude name="org/jboss/web/php/**" />
Modified: trunk/java/org/apache/catalina/Valve.java
===================================================================
--- trunk/java/org/apache/catalina/Valve.java 2008-07-04 07:48:40 UTC (rev 698)
+++ trunk/java/org/apache/catalina/Valve.java 2008-07-04 08:36:15 UTC (rev 699)
@@ -20,11 +20,12 @@
import java.io.IOException;
+
import javax.servlet.ServletException;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
@@ -142,7 +143,7 @@
* @exception ServletException if a servlet error occurs, or is thrown
* by a subsequently invoked Valve, Filter, or Servlet
*/
- public void event(Request request, Response response, CometEvent event)
+ public void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException;
Deleted: trunk/java/org/apache/catalina/connector/CometEventImpl.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CometEventImpl.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/connector/CometEventImpl.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.catalina.connector;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.catalina.util.StringManager;
-import org.jboss.web.comet.CometEvent;
-
-public class CometEventImpl implements CometEvent {
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
- public CometEventImpl(Request request, Response response) {
- this.request = request;
- this.response = response;
- }
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * Associated request.
- */
- protected Request request = null;
-
-
- /**
- * Associated response.
- */
- protected Response response = null;
-
-
- /**
- * Event type.
- */
- protected EventType eventType = EventType.BEGIN;
-
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Clear the event.
- */
- public void clear() {
- request = null;
- response = null;
- }
-
- public void setType(EventType eventType) {
- this.eventType = eventType;
- }
-
- public void close() throws IOException {
- request.setComet(false);
- request.resume();
- }
-
- public EventType getType() {
- return eventType;
- }
-
- public HttpServletRequest getHttpServletRequest() {
- return request.getRequest();
- }
-
- public HttpServletResponse getHttpServletResponse() {
- return response.getResponse();
- }
-
- public void setTimeout(int timeout) {
- request.setTimeout(timeout);
- }
-
- public boolean ready() {
- return response.isWriteable();
- }
-
- public void resume() {
- request.resume();
- }
-
- public void suspend() {
- request.suspend();
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer("CometEventImpl[");
- buf.append(super.toString());
- buf.append("] Event:");
- buf.append(getType());
- return buf.toString();
- }
-
-}
Modified: trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
===================================================================
--- trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/connector/CoyoteAdapter.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -35,7 +35,7 @@
import org.apache.tomcat.util.http.ServerCookie;
import org.apache.tomcat.util.net.SocketStatus;
import org.jboss.logging.Logger;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
@@ -147,7 +147,7 @@
if (response.isClosed()) {
// The response IO has been closed asynchronously, so call end
// in most cases
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
request.setComet(false);
close = true;
}
@@ -155,7 +155,7 @@
if (!request.isComet()) {
// The event has been closed asynchronously, so call end instead
of
// read to cleanup the pipeline
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
close = true;
} else {
try {
@@ -170,11 +170,11 @@
error = true;
}
if (read) {
- request.getEvent().setType(CometEvent.EventType.READ);
+ request.getEvent().setType(HttpEvent.EventType.READ);
} else if (error) {
- request.getEvent().setType(CometEvent.EventType.ERROR);
+ request.getEvent().setType(HttpEvent.EventType.ERROR);
} else if (eof) {
- request.getEvent().setType(CometEvent.EventType.EOF);
+ request.getEvent().setType(HttpEvent.EventType.EOF);
} else {
// Data was present on the socket, but it did not translate
into actual
// entity body bytes
@@ -185,10 +185,10 @@
if (!request.isComet()) {
// The event has been closed asynchronously, so call end instead
of
// read to cleanup the pipeline
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
close = true;
} else {
- request.getEvent().setType(CometEvent.EventType.WRITE);
+ request.getEvent().setType(HttpEvent.EventType.WRITE);
}
} else if (status == SocketStatus.OPEN_CALLBACK) {
if (!request.isComet()) {
@@ -196,28 +196,28 @@
// read to cleanup the pipeline
// In nearly all cases, the close does a resume which will end
up
// here
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
close = true;
} else {
- request.getEvent().setType(CometEvent.EventType.EVENT);
+ request.getEvent().setType(HttpEvent.EventType.EVENT);
}
} else if (status == SocketStatus.DISCONNECT) {
- request.getEvent().setType(CometEvent.EventType.ERROR);
+ request.getEvent().setType(HttpEvent.EventType.ERROR);
error = true;
} else if (status == SocketStatus.ERROR) {
- request.getEvent().setType(CometEvent.EventType.ERROR);
+ request.getEvent().setType(HttpEvent.EventType.ERROR);
error = true;
} else if (status == SocketStatus.STOP) {
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
close = true;
} else if (status == SocketStatus.TIMEOUT) {
if (!request.isComet()) {
// The event has been closed asynchronously, so call end instead
of
// read to cleanup the pipeline
- request.getEvent().setType(CometEvent.EventType.END);
+ request.getEvent().setType(HttpEvent.EventType.END);
close = true;
} else {
- request.getEvent().setType(CometEvent.EventType.TIMEOUT);
+ request.getEvent().setType(HttpEvent.EventType.TIMEOUT);
}
}
@@ -229,7 +229,7 @@
if (!error && (request.getAttribute(Globals.EXCEPTION_ATTR) !=
null)) {
// An unexpected exception occurred while processing the event, so
// error should be called
- request.getEvent().setType(CometEvent.EventType.ERROR);
+ request.getEvent().setType(HttpEvent.EventType.ERROR);
error = true;
connector.getContainer().getPipeline().getFirst().event(request,
response, request.getEvent());
}
@@ -237,13 +237,13 @@
// If this was a read and not all bytes have been read, or if no
data
// was read from the connector, then it is an error
log.error(sm.getString("coyoteAdapter.read"));
- request.getEvent().setType(CometEvent.EventType.ERROR);
+ request.getEvent().setType(HttpEvent.EventType.ERROR);
error = true;
connector.getContainer().getPipeline().getFirst().event(request,
response, request.getEvent());
}
if (!error && !eof && (status == SocketStatus.OPEN_READ)
&& request.isEof()) {
// Send an EOF event
- request.getEvent().setType(CometEvent.EventType.EOF);
+ request.getEvent().setType(HttpEvent.EventType.EOF);
eof = true;
connector.getContainer().getPipeline().getFirst().event(request,
response, request.getEvent());
}
Copied: trunk/java/org/apache/catalina/connector/HttpEventImpl.java (from rev 695,
trunk/java/org/apache/catalina/connector/CometEventImpl.java)
===================================================================
--- trunk/java/org/apache/catalina/connector/HttpEventImpl.java
(rev 0)
+++ trunk/java/org/apache/catalina/connector/HttpEventImpl.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.connector;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.util.StringManager;
+import org.jboss.servlet.http.HttpEvent;
+
+public class HttpEventImpl implements HttpEvent {
+
+ /**
+ * The string manager for this package.
+ */
+ protected static StringManager sm =
+ StringManager.getManager(Constants.Package);
+
+
+ public HttpEventImpl(Request request, Response response) {
+ this.request = request;
+ this.response = response;
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * Associated request.
+ */
+ protected Request request = null;
+
+
+ /**
+ * Associated response.
+ */
+ protected Response response = null;
+
+
+ /**
+ * Event type.
+ */
+ protected EventType eventType = EventType.BEGIN;
+
+
+ // --------------------------------------------------------- Public Methods
+
+ /**
+ * Clear the event.
+ */
+ public void clear() {
+ request = null;
+ response = null;
+ }
+
+ public void setType(EventType eventType) {
+ this.eventType = eventType;
+ }
+
+ public void close() throws IOException {
+ request.setComet(false);
+ request.resume();
+ }
+
+ public EventType getType() {
+ return eventType;
+ }
+
+ public HttpServletRequest getHttpServletRequest() {
+ return request.getRequest();
+ }
+
+ public HttpServletResponse getHttpServletResponse() {
+ return response.getResponse();
+ }
+
+ public void setTimeout(int timeout) {
+ request.setTimeout(timeout);
+ }
+
+ public boolean isReadReady() {
+ return request.isReadable();
+ }
+
+ public boolean isWriteReady() {
+ return response.isWriteable();
+ }
+
+ public void resume() {
+ request.resume();
+ }
+
+ public void suspend() {
+ request.suspend();
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer("CometEventImpl[");
+ buf.append(super.toString());
+ buf.append("] Event:");
+ buf.append(getType());
+ return buf.toString();
+ }
+
+}
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2008-07-04 07:48:40 UTC (rev
698)
+++ trunk/java/org/apache/catalina/connector/Request.java 2008-07-04 08:36:15 UTC (rev
699)
@@ -205,7 +205,7 @@
/**
* Associated event.
*/
- protected CometEventImpl event = null;
+ protected HttpEventImpl event = null;
/**
@@ -481,6 +481,14 @@
}
+ /**
+ * Return true if bytes are available.
+ */
+ public boolean isReadable() {
+ return (inputBuffer.available() > 0);
+ }
+
+
// -------------------------------------------------------- Request Methods
@@ -2239,9 +2247,9 @@
* Get the event associated with the request.
* @return
*/
- public CometEventImpl getEvent() {
+ public HttpEventImpl getEvent() {
if (event == null) {
- event = new CometEventImpl(this, response);
+ event = new HttpEventImpl(this, response);
}
return event;
}
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2008-07-04 07:48:40
UTC (rev 698)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterChain.java 2008-07-04 08:36:15
UTC (rev 699)
@@ -37,10 +37,10 @@
import org.apache.catalina.security.SecurityUtil;
import org.apache.catalina.util.InstanceSupport;
import org.apache.catalina.util.StringManager;
-import org.jboss.web.comet.CometEvent;
-import org.jboss.web.comet.CometFilter;
-import org.jboss.web.comet.CometFilterChain;
-import org.jboss.web.comet.CometProcessor;
+import org.jboss.servlet.http.HttpEvent;
+import org.jboss.servlet.http.HttpEventFilter;
+import org.jboss.servlet.http.HttpEventFilterChain;
+import org.jboss.servlet.http.HttpEventServlet;
/**
* Implementation of <code>javax.servlet.FilterChain</code> used to manage
@@ -53,7 +53,7 @@
* @version $Revision$ $Date$
*/
-final class ApplicationFilterChain implements FilterChain, CometFilterChain {
+final class ApplicationFilterChain implements FilterChain, HttpEventFilterChain {
// Used to enforce requirements of SRV.8.2 / SRV.14.2.5.1
private final static ThreadLocal lastServicedRequest;
@@ -152,14 +152,14 @@
* <code>doFilterEvent</code> is invoked.
*/
private static Class[] cometClassType =
- new Class[]{ CometEvent.class, CometFilterChain.class};
+ new Class[]{ HttpEvent.class, HttpEventFilterChain.class};
/**
* Static class array used when the SecurityManager is turned on and
* <code>event</code> is invoked.
*/
private static Class[] classTypeUsedInEvent =
- new Class[] { CometEvent.class };
+ new Class[] { HttpEvent.class };
// ---------------------------------------------------- FilterChain Methods
@@ -333,11 +333,11 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
- public void doFilterEvent(CometEvent event)
+ public void doFilterEvent(HttpEvent event)
throws IOException, ServletException {
if( Globals.IS_SECURITY_ENABLED ) {
- final CometEvent ev = event;
+ final HttpEvent ev = event;
try {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction() {
@@ -387,15 +387,15 @@
}
- private void internalDoFilterEvent(CometEvent event)
+ private void internalDoFilterEvent(HttpEvent event)
throws IOException, ServletException {
// Call the next filter if there is one
if (pos < n) {
ApplicationFilterConfig filterConfig = filters[pos++];
- CometFilter filter = null;
+ HttpEventFilter filter = null;
try {
- filter = (CometFilter) filterConfig.getFilter();
+ filter = (HttpEventFilter) filterConfig.getFilter();
// FIXME: No instance listener processing for events for now
/*
support.fireInstanceEvent(InstanceEvent.BEFORE_FILTER_EVENT,
@@ -403,7 +403,7 @@
*/
if( Globals.IS_SECURITY_ENABLED ) {
- final CometEvent ev = event;
+ final HttpEvent ev = event;
Principal principal =
ev.getHttpServletRequest().getUserPrincipal();
@@ -456,7 +456,7 @@
servlet, request, response);
*/
if( Globals.IS_SECURITY_ENABLED ) {
- final CometEvent ev = event;
+ final HttpEvent ev = event;
Principal principal =
ev.getHttpServletRequest().getUserPrincipal();
Object[] args = new Object[]{ ev };
@@ -467,7 +467,7 @@
principal);
args = null;
} else {
- ((CometProcessor) servlet).event(event);
+ ((HttpEventServlet) servlet).event(event);
}
/*
support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
Modified: trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
===================================================================
--- trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2008-07-04 07:48:40
UTC (rev 698)
+++ trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java 2008-07-04 08:36:15
UTC (rev 699)
@@ -27,7 +27,7 @@
import org.apache.catalina.Wrapper;
import org.apache.catalina.connector.Request;
import org.apache.catalina.deploy.FilterMap;
-import org.jboss.web.comet.CometFilter;
+import org.jboss.servlet.http.HttpEventFilter;
/**
* Factory for the creation and caching of Filters and creationg
@@ -174,7 +174,7 @@
boolean isCometFilter = false;
if (comet) {
try {
- isCometFilter = filterConfig.getFilter() instanceof CometFilter;
+ isCometFilter = filterConfig.getFilter() instanceof HttpEventFilter;
} catch (Exception e) {
// Note: The try catch is there because getFilter has a lot of
// declared exceptions. However, the filter is allocated much
@@ -204,7 +204,7 @@
boolean isCometFilter = false;
if (comet) {
try {
- isCometFilter = filterConfig.getFilter() instanceof CometFilter;
+ isCometFilter = filterConfig.getFilter() instanceof HttpEventFilter;
} catch (Exception e) {
// Note: The try catch is there because getFilter has a lot of
// declared exceptions. However, the filter is allocated much
Modified: trunk/java/org/apache/catalina/core/StandardContextValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContextValve.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/core/StandardContextValve.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -35,7 +35,7 @@
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
import org.apache.tomcat.util.buf.MessageBytes;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
* Valve that implements the default basic behavior for the
@@ -226,7 +226,7 @@
* @exception IOException if an input/output error occurred
* @exception ServletException if a servlet error occurred
*/
- public final void event(Request request, Response response, CometEvent event)
+ public final void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Select the Wrapper to be used for this Request
Modified: trunk/java/org/apache/catalina/core/StandardEngineValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardEngineValve.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/core/StandardEngineValve.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -29,7 +29,7 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
@@ -121,7 +121,7 @@
* @exception IOException if an input/output error occurred
* @exception ServletException if a servlet error occurred
*/
- public final void event(Request request, Response response, CometEvent event)
+ public final void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Ask this Host to process this request
Modified: trunk/java/org/apache/catalina/core/StandardHostValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHostValve.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/core/StandardHostValve.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -37,7 +37,7 @@
import org.apache.catalina.util.StringManager;
import org.apache.catalina.valves.ValveBase;
import org.jboss.logging.Logger;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
@@ -160,7 +160,7 @@
* @exception IOException if an input/output error occurred
* @exception ServletException if a servlet error occurred
*/
- public final void event(Request request, Response response, CometEvent event)
+ public final void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Select the Context to be used for this Request
Modified: trunk/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2008-07-04 07:48:40 UTC
(rev 698)
+++ trunk/java/org/apache/catalina/core/StandardWrapperValve.java 2008-07-04 08:36:15 UTC
(rev 699)
@@ -37,8 +37,8 @@
import org.apache.catalina.valves.ValveBase;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.log.SystemLogHandler;
-import org.jboss.web.comet.CometEvent;
-import org.jboss.web.comet.CometProcessor;
+import org.jboss.servlet.http.HttpEvent;
+import org.jboss.servlet.http.HttpEventServlet;
/**
* Valve that implements the default basic behavior for the
@@ -159,7 +159,7 @@
// Identify if the request is Comet related now that the servlet has been
allocated
boolean comet = false;
- if (servlet instanceof CometProcessor
+ if (servlet instanceof HttpEventServlet
&&
request.getAttribute("org.apache.tomcat.comet.support") == Boolean.TRUE) {
comet = true;
request.setComet(true);
@@ -349,7 +349,7 @@
* @exception ServletException if a servlet error occurs, or is thrown
* by a subsequently invoked Valve, Filter, or Servlet
*/
- public void event(Request request, Response response, CometEvent event)
+ public void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Initialize local variables we may need
Modified: trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java
===================================================================
--- trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2008-07-04
07:48:40 UTC (rev 698)
+++ trunk/java/org/apache/catalina/valves/CometConnectionManagerValve.java 2008-07-04
08:36:15 UTC (rev 699)
@@ -35,13 +35,13 @@
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.connector.CometEventImpl;
+import org.apache.catalina.connector.HttpEventImpl;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
-import org.jboss.web.comet.CometEvent;
-import org.jboss.web.comet.CometProcessor;
+import org.jboss.servlet.http.HttpEvent;
+import org.jboss.servlet.http.HttpEventServlet;
/**
@@ -205,8 +205,8 @@
}
// Close the comet connection
try {
- CometEventImpl cometEvent = request.getEvent();
- cometEvent.setType(CometEvent.EventType.END);
+ HttpEventImpl cometEvent = request.getEvent();
+ cometEvent.setType(HttpEvent.EventType.END);
getNext().event(request, request.getResponse(), cometEvent);
cometEvent.close();
} catch (Exception e) {
@@ -286,7 +286,7 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet error occurs
*/
- public void event(Request request, Response response, CometEvent event)
+ public void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Perform the request
@@ -296,8 +296,8 @@
ok = true;
} finally {
if (!ok || response.isClosed()
- || (event.getType() == CometEvent.EventType.END)
- || (event.getType() == CometEvent.EventType.ERROR)) {
+ || (event.getType() == HttpEvent.EventType.END)
+ || (event.getType() == HttpEvent.EventType.ERROR)) {
// Remove the connection from webapp reload tracking
cometRequests.remove(request);
@@ -353,9 +353,9 @@
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
- CometEventImpl event = req.getEvent();
- event.setType(CometEvent.EventType.END);
- ((CometProcessor) req.getWrapper().getServlet()).event(event);
+ HttpEventImpl event = req.getEvent();
+ event.setType(HttpEvent.EventType.END);
+ ((HttpEventServlet) req.getWrapper().getServlet()).event(event);
event.close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
Modified: trunk/java/org/apache/catalina/valves/ValveBase.java
===================================================================
--- trunk/java/org/apache/catalina/valves/ValveBase.java 2008-07-04 07:48:40 UTC (rev
698)
+++ trunk/java/org/apache/catalina/valves/ValveBase.java 2008-07-04 08:36:15 UTC (rev
699)
@@ -40,7 +40,7 @@
import org.apache.catalina.core.ContainerBase;
import org.apache.catalina.util.StringManager;
import org.jboss.logging.Logger;
-import org.jboss.web.comet.CometEvent;
+import org.jboss.servlet.http.HttpEvent;
/**
@@ -193,7 +193,7 @@
* @exception ServletException if a servlet error occurs, or is thrown
* by a subsequently invoked Valve, Filter, or Servlet
*/
- public void event(Request request, Response response, CometEvent event)
+ public void event(Request request, Response response, HttpEvent event)
throws IOException, ServletException {
// Perform the request
getNext().event(request, response, event);
Modified: trunk/java/org/jboss/servlet/http/HttpEvent.java
===================================================================
--- trunk/java/org/jboss/servlet/http/HttpEvent.java 2008-07-04 07:48:40 UTC (rev 698)
+++ trunk/java/org/jboss/servlet/http/HttpEvent.java 2008-07-04 08:36:15 UTC (rev 699)
@@ -133,7 +133,7 @@
* Returns true when data may be read from the connection (the flag becomes false if
no data
* is available to read). When the flag becomes false, the Servlet can attempt to
read additional
* data, but it will block until data is available. This method is equivalent to
- * (Reader.ready() > 0) and InputStream.available().
+ * Reader.ready() and (InputStream.available() > 0).
*
* @return boolean true if data can be read without blocking
*/
Modified: trunk/webapps/docs/aio.xml
===================================================================
--- trunk/webapps/docs/aio.xml 2008-07-04 07:48:40 UTC (rev 698)
+++ trunk/webapps/docs/aio.xml 2008-07-04 08:36:15 UTC (rev 699)
@@ -39,10 +39,10 @@
other source).
</p>
- <subsection name="CometEvent">
+ <subsection name="HttpEvent">
<p>
- Servlets which implement the
<code>org.jboss.web.comet.CometProcessor</code>
+ Servlets which implement the
<code>org.jboss.servlet.http.HttpEventServlet</code>
interface will have their event method invoked rather than the usual service
method, according to the event which occurred. The event object gives
access to the usual request and response objects, which may be used in the
@@ -81,7 +81,7 @@
objects will be recycled and used to process other requests. In particular,
this event will be called if the HTTP session associated with the connection
times out, if the web application is reloaded, if the server is shutdown, or
- if the Comet connection was closed asynchronously.</li>
+ if the connection was closed asynchronously.</li>
<li>EventType.EOF - The end of file of the input has been reached, and no further
data is
available. This event is sent because it can be difficult to detect otherwise.
Following the processing of this event and the processing of any subsequent
@@ -94,7 +94,7 @@
<li>EventType.TIMEOUT - the connection timed out, but the connection will not be
closed unless
the servlet uses the close method of the event</li>
<li>EventType.EVENT - Event will be called by the container after the resume()
method is called,
- during which any operations can be performed, including closing the Comet
connection
+ during which any operations can be performed, including closing the connection
using the close() method.</li>
<li>EventType.WRITE - Write is sent if the servlet is using the ready method.
This means that
the connection is ready to receive data to be written out. This event will never
@@ -103,13 +103,13 @@
</ul>
<p>
- As described above, the typical lifecycle of a Comet request will consist in a series
of
+ As described above, the typical lifecycle of a request will consist in a series of
events such as: BEGIN -> READ -> READ -> READ -> TIMEOUT. At any time,
the servlet
may end processing of the request by using the close method of the event object.
</p>
<p>
- The close() method ends the request, which marks the end of the comet session. This
will send
+ The close() method ends the request, which marks the end of the processing. This will
send
back to the client a notice that the server has no more data to send
as part of this request. An END event will be sent to the servlet.
</p>
@@ -122,7 +122,15 @@
</p>
<p>
- The ready() method returns true when data may be written to the connection (the flag
becomes false
+ The isReadReady() method returns true when data may be read from the connection (the
flag becomes false if no data
+ is available to read). When the flag becomes false, the Servlet can attempt to read
additional
+ data, but it will block until data is available. This method is equivalent to
+ Reader.ready() and (InputStream.available() > 0).
+
+ </p>
+
+ <p>
+ The isWriteReady() method returns true when data may be written to the connection
(the flag becomes false
when the client is unable to accept data fast enough). When the flag becomes false,
the servlet must stop writing data. If there's an attempt to flush additional
data
to the client and data still cannot be written immediately, an IOException will be
@@ -152,15 +160,15 @@
</subsection>
- <subsection name="CometFilter">
+ <subsection name="HttpEventFilter">
<p>
- Similar to regular filters, a filter chain is invoked when comet events are
processed.
- These filters should implement the CometFilter interface (which works in the same way
as
+ Similar to regular filters, a filter chain is invoked when events are processed.
+ These filters should implement the HttpEventFilter interface (which works in the same
way as
the regular Filter interface), and should be declared and mapped in the deployment
descriptor in the same way as a regular filter. The filter chain when processing an
event
will only include filters which match all the usual mapping rules, and also
implement
- the CometFiler interface.
+ the HttpEventFiler interface.
</p>
</subsection>
@@ -174,7 +182,7 @@
<source>
public class ChatServlet
- extends HttpServlet implements CometProcessor {
+ extends HttpServlet implements HttpEventServlet {
protected ArrayList<HttpServletResponse> connections =
new ArrayList<HttpServletResponse>();
@@ -195,13 +203,13 @@
}
/**
- * Process the given Comet event.
+ * Process the given event.
*
- * @param event The Comet event that will be processed
+ * @param event The event that will be processed
* @throws IOException
* @throws ServletException
*/
- public void event(CometEvent event)
+ public void event(HttpEvent event)
throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-07-04 07:48:40 UTC (rev 698)
+++ trunk/webapps/docs/changelog.xml 2008-07-04 08:36:15 UTC (rev 699)
@@ -98,6 +98,9 @@
<fix>
Extract the query string before normalization when getting a request dispatcher.
(remm)
</fix>
+ <update>
+ Update the Comet API names to org.jboss.servlet.http. (remm)
+ </update>
</changelog>
</subsection>
<subsection name="Coyote">