if (body != null) {
request.getCoyoteRequest().action
- (ActionCode.ACTION_REQ_SET_BODY_REPLAY, body);
+ (ActionCode.REQ_SET_BODY_REPLAY, body);
// Set content type
MessageBytes contentType = MessageBytes.newInstance();
request.getAttribute(Globals.CERTIFICATES_ATTR);
if ((certs == null) || (certs.length < 1)) {
request.getCoyoteRequest().action
- (ActionCode.ACTION_REQ_SSL_CERTIFICATE, null);
+ (ActionCode.REQ_SSL_CERTIFICATE, null);
certs = (X509Certificate[])
request.getAttribute(Globals.CERTIFICATES_ATTR);
}
error = true;
connector.getService().getContainer().getPipeline().getFirst().event(request, response, request.getEvent());
}
- res.action(ActionCode.ACTION_COMET_END, null);
+ res.action(ActionCode.COMET_END, null);
} else if (!error && read && request.getAvailable()) {
// 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
}
} else if (impl.getState()==AsyncContextImpl.AsyncState.STARTED){
//TODO SERVLET3 - async
- res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
+ res.action(ActionCode.ASYNC_START, request.getAsyncContext());
async = true;
break;
} else if (impl.getState()==AsyncContextImpl.AsyncState.NOT_STARTED){
// Invoke a read event right away if there are available bytes
if (event(req, res, SocketStatus.OPEN)) {
comet = true;
- res.action(ActionCode.ACTION_COMET_BEGIN, null);
+ res.action(ActionCode.COMET_BEGIN, null);
}
} else {
comet = true;
- res.action(ActionCode.ACTION_COMET_BEGIN, null);
+ res.action(ActionCode.COMET_BEGIN, null);
}
} else {
// Clear the filter chain, as otherwise it will not be reset elsewhere
}
if (!async && !comet) {
response.finishResponse();
- req.action(ActionCode.ACTION_POST_REQUEST , null);
+ req.action(ActionCode.POST_REQUEST , null);
}
} catch (IOException e) {
// Invoke a read event right away if there are available bytes
if (event(req, res, SocketStatus.OPEN)) {
comet = true;
- res.action(ActionCode.ACTION_COMET_BEGIN, null);
+ res.action(ActionCode.COMET_BEGIN, null);
}
} else {
comet = true;
- res.action(ActionCode.ACTION_COMET_BEGIN, null);
+ res.action(ActionCode.COMET_BEGIN, null);
}
} else {
// Clear the filter chain, as otherwise it will not be reset elsewhere
}
AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
if (asyncConImpl!=null && asyncConImpl.getState()==AsyncContextImpl.AsyncState.STARTED) {
- res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
+ res.action(ActionCode.ASYNC_START, request.getAsyncContext());
async = true;
} else if (request.isAsyncDispatching()) {
asyncDispatch(req, res, SocketStatus.OPEN);
if (request.isAsyncStarted()) {
async = true;
- res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
+ res.action(ActionCode.ASYNC_START, request.getAsyncContext());
}
} else if (!comet) {
response.finishResponse();
- req.action(ActionCode.ACTION_POST_REQUEST , null);
+ req.action(ActionCode.POST_REQUEST , null);
}
} catch (IOException e) {
serverName = req.localName();
if (serverName.isNull()) {
// well, they did ask for it
- res.action(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, null);
+ res.action(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, null);
}
} else {
serverName = req.serverName();
available = cb.getLength();
}
if (available == 0) {
- coyoteRequest.action(ActionCode.ACTION_AVAILABLE, null);
+ coyoteRequest.action(ActionCode.AVAILABLE, null);
available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
}
return available;
doFlush = false;
if (realFlush) {
- coyoteResponse.action(ActionCode.ACTION_CLIENT_FLUSH,
+ coyoteResponse.action(ActionCode.CLIENT_FLUSH,
coyoteResponse);
// If some exception occurred earlier, or if some IOE occurred
// here, notify the servlet with an IOE
if(attr != null)
return attr;
if( isSSLAttribute(name) ) {
- coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE,
+ coyoteRequest.action(ActionCode.REQ_SSL_ATTRIBUTE,
coyoteRequest);
attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
if( attr != null) {
public String getRemoteAddr() {
if (remoteAddr == null) {
coyoteRequest.action
- (ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
remoteAddr = coyoteRequest.remoteAddr().toString();
}
return remoteAddr;
remoteHost = getRemoteAddr();
} else {
coyoteRequest.action
- (ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_HOST_ATTRIBUTE, coyoteRequest);
remoteHost = coyoteRequest.remoteHost().toString();
}
}
public int getRemotePort(){
if (remotePort == -1) {
coyoteRequest.action
- (ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
remotePort = coyoteRequest.getRemotePort();
}
return remotePort;
public String getLocalName(){
if (localName == null) {
coyoteRequest.action
- (ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
localName = coyoteRequest.localName().toString();
}
return localName;
public String getLocalAddr(){
if (localAddr == null) {
coyoteRequest.action
- (ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
localAddr = coyoteRequest.localAddr().toString();
}
return localAddr;
public int getLocalPort(){
if (localPort == -1){
coyoteRequest.action
- (ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
+ (ActionCode.REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
localPort = coyoteRequest.getLocalPort();
}
return localPort;
}
public void cometClose() {
- coyoteRequest.action(ActionCode.ACTION_COMET_CLOSE,getEvent());
+ coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
}
public void setCometTimeout(long timeout) {
- coyoteRequest.action(ActionCode.ACTION_COMET_SETTIMEOUT,new Long(timeout));
+ coyoteRequest.action(ActionCode.COMET_SETTIMEOUT,new Long(timeout));
}
/**
state.compareAndSet(AsyncState.TIMING_OUT_NEED_COMPLETE,
AsyncState.COMPLETING)) {
AtomicBoolean dispatched = new AtomicBoolean(false);
- request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_COMPLETE,
+ request.getCoyoteRequest().action(ActionCode.ASYNC_COMPLETE,
dispatched);
if (!dispatched.get()) doInternalComplete(false);
} else {
};
this.dispatch = run;
AtomicBoolean dispatched = new AtomicBoolean(false);
- request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_DISPATCH, dispatched );
+ request.getCoyoteRequest().action(ActionCode.ASYNC_DISPATCH, dispatched );
if (!dispatched.get()) {
try {
doInternalDispatch();
@Override
public void setTimeout(long timeout) {
this.timeout = timeout;
- request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_SETTIMEOUT,
+ request.getCoyoteRequest().action(ActionCode.ASYNC_SETTIMEOUT,
Long.valueOf(timeout));
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-package org.apache.coyote;
+package org.apache.coyote;
/**
- * Enumerated class containing the adapter event codes.
- * Actions represent callbacks from the servlet container to the coyote
- * connector.
- *
- * Actions are implemented by ProtocolHandler, using the ActionHook interface.
- *
+ * ActionCodes represent callbacks from the servlet container to the coyote
+ * connector. Actions are implemented by ProtocolHandler, using the ActionHook
+ * interface.
+ *
* @see ProtocolHandler
* @see ActionHook
* @author Remy Maucherat
*/
-public final class ActionCode {
-
-
- // -------------------------------------------------------------- Constants
-
-
- public static final ActionCode ACTION_ACK = new ActionCode(1);
-
-
- public static final ActionCode ACTION_CLOSE = new ActionCode(2);
-
-
- public static final ActionCode ACTION_COMMIT = new ActionCode(3);
-
+public enum ActionCode {
+ ACK,
+ CLOSE,
+ COMMIT,
/**
- * A flush() operation originated by the client ( i.e. a flush() on
- * the servlet output stream or writer, called by a servlet ).
- *
- * Argument is the Response.
+ * A flush() operation originated by the client ( i.e. a flush() on the
+ * servlet output stream or writer, called by a servlet ). Argument is the
+ * Response.
*/
- public static final ActionCode ACTION_CLIENT_FLUSH = new ActionCode(4);
-
-
- public static final ActionCode ACTION_CUSTOM = new ActionCode(5);
-
-
- public static final ActionCode ACTION_RESET = new ActionCode(6);
-
-
- public static final ActionCode ACTION_START = new ActionCode(7);
+ CLIENT_FLUSH,
+ CUSTOM,
+ RESET,
+ START,
+ STOP,
+ WEBAPP,
- public static final ActionCode ACTION_STOP = new ActionCode(8);
-
-
- public static final ActionCode ACTION_WEBAPP = new ActionCode(9);
-
- /** Hook called after request, but before recycling. Can be used
- for logging, to update counters, custom cleanup - the request
- is still visible
- */
- public static final ActionCode ACTION_POST_REQUEST = new ActionCode(10);
+ /**
+ * Hook called after request, but before recycling. Can be used for logging,
+ * to update counters, custom cleanup - the request is still visible
+ */
+ POST_REQUEST,
/**
* Callback for lazy evaluation - extract the remote host address.
*/
- public static final ActionCode ACTION_REQ_HOST_ATTRIBUTE =
- new ActionCode(11);
-
+ REQ_HOST_ATTRIBUTE,
/**
- * Callback for lazy evaluation - extract the remote host infos (address, name, port) and local address.
+ * Callback for lazy evaluation - extract the remote host infos (address,
+ * name, port) and local address.
*/
- public static final ActionCode ACTION_REQ_HOST_ADDR_ATTRIBUTE = new ActionCode(12);
+ REQ_HOST_ADDR_ATTRIBUTE,
/**
* Callback for lazy evaluation - extract the SSL-related attributes.
*/
- public static final ActionCode ACTION_REQ_SSL_ATTRIBUTE = new ActionCode(13);
-
+ REQ_SSL_ATTRIBUTE,
- /** Chain for request creation. Called each time a new request is created
- ( requests are recycled ).
+ /**
+ * Chain for request creation. Called each time a new request is created
+ * (requests are recycled).
*/
- public static final ActionCode ACTION_NEW_REQUEST = new ActionCode(14);
-
+ NEW_REQUEST,
/**
- * Callback for lazy evaluation - extract the SSL-certificate
- * (including forcing a re-handshake if necessary)
+ * Callback for lazy evaluation - extract the SSL-certificate (including
+ * forcing a re-handshake if necessary)
*/
- public static final ActionCode ACTION_REQ_SSL_CERTIFICATE = new ActionCode(15);
-
-
+ REQ_SSL_CERTIFICATE,
+
/**
* Callback for lazy evaluation - socket remote port.
- **/
- public static final ActionCode ACTION_REQ_REMOTEPORT_ATTRIBUTE = new ActionCode(16);
+ */
+ REQ_REMOTEPORT_ATTRIBUTE,
-
/**
* Callback for lazy evaluation - socket local port.
- **/
- public static final ActionCode ACTION_REQ_LOCALPORT_ATTRIBUTE = new ActionCode(17);
-
-
+ */
+ REQ_LOCALPORT_ATTRIBUTE,
+
/**
* Callback for lazy evaluation - local address.
- **/
- public static final ActionCode ACTION_REQ_LOCAL_ADDR_ATTRIBUTE = new ActionCode(18);
-
-
+ */
+ REQ_LOCAL_ADDR_ATTRIBUTE,
+
/**
* Callback for lazy evaluation - local address.
- **/
- public static final ActionCode ACTION_REQ_LOCAL_NAME_ATTRIBUTE = new ActionCode(19);
-
+ */
+ REQ_LOCAL_NAME_ATTRIBUTE,
/**
* Callback for setting FORM auth body replay
*/
- public static final ActionCode ACTION_REQ_SET_BODY_REPLAY = new ActionCode(20);
-
+ REQ_SET_BODY_REPLAY,
/**
* Callback for begin Comet processing
*/
- public static final ActionCode ACTION_COMET_BEGIN = new ActionCode(21);
-
+ COMET_BEGIN,
/**
* Callback for end Comet processing
*/
- public static final ActionCode ACTION_COMET_END = new ActionCode(22);
-
+ COMET_END,
/**
* Callback for getting the amount of available bytes
*/
- public static final ActionCode ACTION_AVAILABLE = new ActionCode(23);
+ AVAILABLE,
/**
* Callback for an asynchronous close of the Comet event
*/
- public static final ActionCode ACTION_COMET_CLOSE = new ActionCode(24);
+ COMET_CLOSE,
/**
* Callback for setting the timeout asynchronously
*/
- public static final ActionCode ACTION_COMET_SETTIMEOUT = new ActionCode(25);
-
+ COMET_SETTIMEOUT,
+
/**
* Callback for an async request
*/
- public static final ActionCode ACTION_ASYNC_START = new ActionCode(26);
-
- /**
- * Callback for an async call to {@link javax.servlet.AsyncContext#complete()}
- */
- public static final ActionCode ACTION_ASYNC_COMPLETE = new ActionCode(27);
+ ASYNC_START,
+
/**
- * Callback for an async call to {@link javax.servlet.AsyncContext#setTimeout(long)}
+ * Callback for an async call to
+ * {@link javax.servlet.AsyncContext#complete()}
*/
- public static final ActionCode ACTION_ASYNC_SETTIMEOUT = new ActionCode(28);
-
+ ASYNC_COMPLETE,
/**
- * Callback for an async call to {@link javax.servlet.AsyncContext#dispatch()}
+ * Callback for an async call to
+ * {@link javax.servlet.AsyncContext#setTimeout(long)}
*/
- public static final ActionCode ACTION_ASYNC_DISPATCH = new ActionCode(29);
-
-
- // ----------------------------------------------------------- Constructors
- int code;
+ ASYNC_SETTIMEOUT,
/**
- * Private constructor.
- */
- private ActionCode(int code) {
- this.code=code;
- }
-
- /** Action id, usable in switches and table indexes
+ * Callback for an async call to
+ * {@link javax.servlet.AsyncContext#dispatch()}
*/
- public int getCode() {
- return code;
- }
-
-
+ ASYNC_DISPATCH,
}
}
public String getRemoteAddr() {
- req.action(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, null);
+ req.action(ActionCode.REQ_HOST_ADDR_ATTRIBUTE, null);
return req.remoteAddr().toString();
}
throw new IllegalStateException();
}
- action(ActionCode.ACTION_RESET, this);
+ action(ActionCode.RESET, this);
}
public void finish() throws IOException {
- action(ActionCode.ACTION_CLOSE, this);
+ action(ActionCode.CLOSE, this);
}
public void acknowledge() throws IOException {
- action(ActionCode.ACTION_ACK, this);
+ action(ActionCode.ACK, this);
}
* interceptors to fix headers.
*/
public void sendHeaders() throws IOException {
- action(ActionCode.ACTION_COMMIT, this);
+ action(ActionCode.COMMIT, this);
commited = true;
}
*/
public void action(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_COMMIT) {
+ if (actionCode == ActionCode.COMMIT) {
if (response.isCommitted())
return;
error = true;
}
- } else if (actionCode == ActionCode.ACTION_CLIENT_FLUSH) {
+ } else if (actionCode == ActionCode.CLIENT_FLUSH) {
if (!response.isCommitted()) {
// Validate and write response headers
error = true;
}
- } else if (actionCode == ActionCode.ACTION_CLOSE) {
+ } else if (actionCode == ActionCode.CLOSE) {
// Close
async = false;
error = true;
}
- } else if (actionCode == ActionCode.ACTION_START) {
+ } else if (actionCode == ActionCode.START) {
started = true;
- } else if (actionCode == ActionCode.ACTION_STOP) {
+ } else if (actionCode == ActionCode.STOP) {
started = false;
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
+ } else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
if (!certificates.isNull()) {
ByteChunk certData = certificates.getByteChunk();
request.setAttribute(AbstractEndpoint.CERTIFICATE_KEY, jsseCerts);
}
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
// Get remote host name using a DNS resolution
if (request.remoteHost().isNull()) {
}
}
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
// Copy from local name for now, which should simply be an address
request.localAddr().setString(request.localName().toString());
- } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
+ } else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) {
// Set the given bytes as the content
ByteChunk bc = (ByteChunk) param;
empty = false;
replay = true;
- } else if (actionCode == ActionCode.ACTION_ASYNC_START) {
+ } else if (actionCode == ActionCode.ASYNC_START) {
async = true;
- } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
+ } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
AtomicBoolean dispatch = (AtomicBoolean)param;
RequestInfo rp = request.getRequestProcessor();
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) { //async handling
} else {
dispatch.set(false);
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
if (param==null) return;
if (socket==0) return;
long timeout = ((Long)param).longValue();
Socket.timeoutSet(socket, timeout * 1000);
- } else if (actionCode == ActionCode.ACTION_ASYNC_DISPATCH) {
+ } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
RequestInfo rp = request.getRequestProcessor();
AtomicBoolean dispatch = (AtomicBoolean)param;
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) {//async handling
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
+ processor.action(ActionCode.START, null);
if (processor.process(socket)) {
connections.put(Long.valueOf(socket), processor);
AjpAprProtocol.log.error
(sm.getString("ajpprotocol.proto.error"), e);
} finally {
- processor.action(ActionCode.ACTION_STOP, null);
+ processor.action(ActionCode.STOP, null);
recycledProcessors.offer(processor);
}
return SocketState.CLOSED;
*/
public void action(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_COMMIT) {
+ if (actionCode == ActionCode.COMMIT) {
if (response.isCommitted())
return;
error = true;
}
- } else if (actionCode == ActionCode.ACTION_CLIENT_FLUSH) {
+ } else if (actionCode == ActionCode.CLIENT_FLUSH) {
if (!response.isCommitted()) {
// Validate and write response headers
error = true;
}
- } else if (actionCode == ActionCode.ACTION_CLOSE) {
+ } else if (actionCode == ActionCode.CLOSE) {
// Close
async = false;
// End the processing of the current request, and stop any further
error = true;
}
- } else if (actionCode == ActionCode.ACTION_START) {
+ } else if (actionCode == ActionCode.START) {
started = true;
- } else if (actionCode == ActionCode.ACTION_STOP) {
+ } else if (actionCode == ActionCode.STOP) {
started = false;
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
+ } else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
if (!certificates.isNull()) {
ByteChunk certData = certificates.getByteChunk();
request.setAttribute(AbstractEndpoint.CERTIFICATE_KEY, jsseCerts);
}
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
// Get remote host name using a DNS resolution
if (request.remoteHost().isNull()) {
}
}
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
// Copy from local name for now, which should simply be an address
request.localAddr().setString(request.localName().toString());
- } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
+ } else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) {
// Set the given bytes as the content
ByteChunk bc = (ByteChunk) param;
empty = false;
replay = true;
- } else if (actionCode == ActionCode.ACTION_ASYNC_START) {
+ } else if (actionCode == ActionCode.ASYNC_START) {
//TODO SERVLET3 - async
async = true;
- } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
+ } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
//TODO SERVLET3 - async
AtomicBoolean dispatch = (AtomicBoolean)param;
RequestInfo rp = request.getRequestProcessor();
} else {
dispatch.set(false);
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
//TODO SERVLET3 - async
if (param==null) return;
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
socket.setTimeout(timeout);
- } else if (actionCode == ActionCode.ACTION_ASYNC_DISPATCH) {
+ } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
RequestInfo rp = request.getRequestProcessor();
AtomicBoolean dispatch = (AtomicBoolean)param;
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) {//async handling
if (processor == null) {
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
+ processor.action(ActionCode.START, null);
SocketState state = socket.isAsync()?processor.asyncDispatch(status):processor.process(socket);
if (state == SocketState.LONG) {
AjpProtocol.log.error
(sm.getString("ajpprotocol.proto.error"), e);
} finally {
- processor.action(ActionCode.ACTION_STOP, null);
+ processor.action(ActionCode.STOP, null);
recycledProcessors.offer(processor);
}
return SocketState.CLOSED;
*/
public final void action(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_COMMIT) {
+ if (actionCode == ActionCode.COMMIT) {
// Commit current response
if (response.isCommitted())
// Set error flag
error = true;
}
- } else if (actionCode == ActionCode.ACTION_ACK) {
+ } else if (actionCode == ActionCode.ACK) {
// Acknowledge request
// Send a 100 status back if it makes sense (response not committed
// yet, and client specified an expectation for 100-continue)
// Set error flag
error = true;
}
- } else if (actionCode == ActionCode.ACTION_CLIENT_FLUSH) {
+ } else if (actionCode == ActionCode.CLIENT_FLUSH) {
try {
getOutputBuffer().flush();
response.setErrorException(e);
}
- } else if (actionCode == ActionCode.ACTION_RESET) {
+ } else if (actionCode == ActionCode.RESET) {
// Reset response
// Note: This must be called before the response is committed
getOutputBuffer().reset();
- } else if (actionCode == ActionCode.ACTION_CUSTOM) {
+ } else if (actionCode == ActionCode.CUSTOM) {
// Do nothing
// TODO Remove this action
- } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
+ } else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) {
ByteChunk body = (ByteChunk) param;
InputFilter savedBody = new SavedRequestInputFilter(body);
AbstractInputBuffer internalBuffer = (AbstractInputBuffer)
request.getInputBuffer();
internalBuffer.addActiveFilter(savedBody);
- } else if (actionCode == ActionCode.ACTION_ASYNC_START) {
+ } else if (actionCode == ActionCode.ASYNC_START) {
async = true;
} else {
actionInternal(actionCode, param);
// Send the connector a request for commit. The connector should
// then validate the headers, send them (using sendHeaders) and
// set the filters accordingly.
- response.action(ActionCode.ACTION_COMMIT, null);
+ response.action(ActionCode.COMMIT, null);
}
// Send the connector a request for commit. The connector should
// then validate the headers, send them (using sendHeader) and
// set the filters accordingly.
- response.action(ActionCode.ACTION_COMMIT, null);
+ response.action(ActionCode.COMMIT, null);
}
// Send the connector a request for commit. The connector should
// then validate the headers, send them (using sendHeader) and
// set the filters accordingly.
- response.action(ActionCode.ACTION_COMMIT, null);
+ response.action(ActionCode.COMMIT, null);
}
@Override
public void actionInternal(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_CLOSE) {
+ if (actionCode == ActionCode.CLOSE) {
// Close
// End the processing of the current request, and stop any further
error = true;
}
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ADDR_ATTRIBUTE) {
// Get remote host address
if (remoteAddr == null && (socket != 0)) {
}
request.remoteAddr().setString(remoteAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_NAME_ATTRIBUTE) {
// Get local host name
if (localName == null && (socket != 0)) {
}
request.localName().setString(localName);
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
// Get remote host name
if (remoteHost == null && (socket != 0)) {
}
request.remoteHost().setString(remoteHost);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
// Get local host address
if (localAddr == null && (socket != 0)) {
request.localAddr().setString(localAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_REMOTEPORT_ATTRIBUTE) {
// Get remote port
if (remotePort == -1 && (socket != 0)) {
}
request.setRemotePort(remotePort);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCALPORT_ATTRIBUTE) {
// Get local port
if (localPort == -1 && (socket != 0)) {
}
request.setLocalPort(localPort);
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
+ } else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
if (ssl && (socket != 0)) {
try {
}
}
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
+ } else if (actionCode == ActionCode.REQ_SSL_CERTIFICATE) {
if (ssl && (socket != 0)) {
// Consume and buffer the request body, so that it does not
}
}
- } else if (actionCode == ActionCode.ACTION_AVAILABLE) {
+ } else if (actionCode == ActionCode.AVAILABLE) {
request.setAvailable(inputBuffer.available());
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
+ } else if (actionCode == ActionCode.COMET_BEGIN) {
comet = true;
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
+ } else if (actionCode == ActionCode.COMET_END) {
comet = false;
- } else if (actionCode == ActionCode.ACTION_COMET_CLOSE) {
+ } else if (actionCode == ActionCode.COMET_CLOSE) {
//no op
- } else if (actionCode == ActionCode.ACTION_COMET_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.COMET_SETTIMEOUT) {
//no op
- } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
+ } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
//TODO SERVLET3 - async - that is bit hacky -
AtomicBoolean dispatch = (AtomicBoolean)param;
RequestInfo rp = request.getRequestProcessor();
} else {
dispatch.set(false);
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
//TODO SERVLET3 - async
if (param==null) return;
if (socket==0) return;
long timeout = ((Long)param).longValue();
Socket.timeoutSet(socket, timeout * 1000);
- } else if (actionCode == ActionCode.ACTION_ASYNC_DISPATCH) {
+ } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
RequestInfo rp = request.getRequestProcessor();
AtomicBoolean dispatch = (AtomicBoolean)param;
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) {//async handling
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
+ processor.action(ActionCode.START, null);
SocketState state = processor.process(socket);
if (state == SocketState.LONG) {
@Override
public void actionInternal(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_CLOSE) {
+ if (actionCode == ActionCode.CLOSE) {
// Close
// End the processing of the current request, and stop any further
error = true;
}
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ADDR_ATTRIBUTE) {
// Get remote host address
if ((remoteAddr == null) && (socket != null)) {
}
request.remoteAddr().setString(remoteAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_NAME_ATTRIBUTE) {
// Get local host name
if ((localName == null) && (socket != null)) {
}
request.localName().setString(localName);
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
// Get remote host name
if ((remoteHost == null) && (socket != null)) {
}
request.remoteHost().setString(remoteHost);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
if (localAddr == null)
localAddr = socket.getIOChannel().socket().getLocalAddress().getHostAddress();
request.localAddr().setString(localAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_REMOTEPORT_ATTRIBUTE) {
if ((remotePort == -1 ) && (socket !=null)) {
remotePort = socket.getIOChannel().socket().getPort();
}
request.setRemotePort(remotePort);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCALPORT_ATTRIBUTE) {
if ((localPort == -1 ) && (socket !=null)) {
localPort = socket.getIOChannel().socket().getLocalPort();
}
request.setLocalPort(localPort);
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
+ } else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
try {
if (sslSupport != null) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
}
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
+ } else if (actionCode == ActionCode.REQ_SSL_CERTIFICATE) {
if( sslSupport != null) {
/*
}
}
- } else if (actionCode == ActionCode.ACTION_AVAILABLE) {
+ } else if (actionCode == ActionCode.AVAILABLE) {
request.setAvailable(inputBuffer.available());
- } else if (actionCode == ActionCode.ACTION_COMET_BEGIN) {
+ } else if (actionCode == ActionCode.COMET_BEGIN) {
comet = true;
- } else if (actionCode == ActionCode.ACTION_COMET_END) {
+ } else if (actionCode == ActionCode.COMET_END) {
comet = false;
- } else if (actionCode == ActionCode.ACTION_COMET_CLOSE) {
+ } else if (actionCode == ActionCode.COMET_CLOSE) {
if (socket==null || socket.getAttachment(false)==null) return;
NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
attach.setCometOps(NioEndpoint.OP_CALLBACK);
RequestInfo rp = request.getRequestProcessor();
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) //async handling
socket.getPoller().cometInterest(socket);
- } else if (actionCode == ActionCode.ACTION_COMET_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.COMET_SETTIMEOUT) {
if (param==null) return;
if (socket==null || socket.getAttachment(false)==null) return;
NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
RequestInfo rp = request.getRequestProcessor();
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) //async handling
attach.setTimeout(timeout);
- } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
+ } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
//TODO SERVLET3 - async
AtomicBoolean dispatch = (AtomicBoolean)param;
RequestInfo rp = request.getRequestProcessor();
} else {
dispatch.set(false);
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
//TODO SERVLET3 - async
if (param==null) return;
if (socket==null || socket.getAttachment(false)==null) return;
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
attach.setTimeout(timeout);
- } else if (actionCode == ActionCode.ACTION_ASYNC_DISPATCH) {
+ } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
RequestInfo rp = request.getRequestProcessor();
AtomicBoolean dispatch = (AtomicBoolean)param;
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) {//async handling
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
+ processor.action(ActionCode.START, null);
if (proto.endpoint.isSSLEnabled() && (proto.sslImplementation != null)) {
if (socket instanceof SecureNioChannel) {
@Override
public void actionInternal(ActionCode actionCode, Object param) {
- if (actionCode == ActionCode.ACTION_CLOSE) {
+ if (actionCode == ActionCode.CLOSE) {
// Close
async = false;
// End the processing of the current request, and stop any further
error = true;
}
- } else if (actionCode == ActionCode.ACTION_START) {
+ } else if (actionCode == ActionCode.START) {
started = true;
- } else if (actionCode == ActionCode.ACTION_STOP) {
+ } else if (actionCode == ActionCode.STOP) {
started = false;
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
+ } else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
try {
if (sslSupport != null) {
log.warn(sm.getString("http11processor.socket.ssl"), e);
}
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ADDR_ATTRIBUTE) {
if ((remoteAddr == null) && (socket != null)) {
InetAddress inetAddr = socket.getSocket().getInetAddress();
}
request.remoteAddr().setString(remoteAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_NAME_ATTRIBUTE) {
if ((localName == null) && (socket != null)) {
InetAddress inetAddr = socket.getSocket().getLocalAddress();
}
request.localName().setString(localName);
- } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
if ((remoteHost == null) && (socket != null)) {
InetAddress inetAddr = socket.getSocket().getInetAddress();
}
request.remoteHost().setString(remoteHost);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
if (localAddr == null)
localAddr = socket.getSocket().getLocalAddress().getHostAddress();
request.localAddr().setString(localAddr);
- } else if (actionCode == ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_REMOTEPORT_ATTRIBUTE) {
if ((remotePort == -1 ) && (socket !=null)) {
remotePort = socket.getSocket().getPort();
}
request.setRemotePort(remotePort);
- } else if (actionCode == ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE) {
+ } else if (actionCode == ActionCode.REQ_LOCALPORT_ATTRIBUTE) {
if ((localPort == -1 ) && (socket !=null)) {
localPort = socket.getSocket().getLocalPort();
}
request.setLocalPort(localPort);
- } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
+ } else if (actionCode == ActionCode.REQ_SSL_CERTIFICATE) {
if( sslSupport != null) {
/*
* Consume and buffer the request body, so that it does not
log.warn(sm.getString("http11processor.socket.ssl"), e);
}
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
+ } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
//TODO SERVLET3 - async
AtomicBoolean dispatch = (AtomicBoolean)param;
RequestInfo rp = request.getRequestProcessor();
} else {
dispatch.set(false);
}
- } else if (actionCode == ActionCode.ACTION_ASYNC_SETTIMEOUT) {
+ } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
//TODO SERVLET3 - async
if (param==null) return;
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
socket.setTimeout(timeout);
- } else if (actionCode == ActionCode.ACTION_ASYNC_DISPATCH) {
+ } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
RequestInfo rp = request.getRequestProcessor();
AtomicBoolean dispatch = (AtomicBoolean)param;
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) {//async handling
if (processor == null) {
processor = createProcessor();
}
- processor.action(ActionCode.ACTION_START, null);
+ processor.action(ActionCode.START, null);
if (proto.isSSLEnabled() && (proto.sslImplementation != null)) {
processor.setSSLSupport
// processor.recycle();
if (recycle) {
- processor.action(ActionCode.ACTION_STOP, null);
+ processor.action(ActionCode.STOP, null);
recycledProcessors.offer(processor);
}
}
// Send the connector a request for commit. The connector should
// then validate the headers, send them (using sendHeader) and
// set the filters accordingly.
- response.action(ActionCode.ACTION_COMMIT, null);
+ response.action(ActionCode.COMMIT, null);
}