AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
//TODO SERVLET3 - async
//configure settings for timed out
- asyncConImpl.setErrorState();
+ asyncConImpl.setErrorState(new IOException("Socket error."));
}
while (success) {
AsyncContextImpl impl = (AsyncContextImpl)request.getAsyncContext();
//TODO SERVLET3 - async
async = false;
break;
+ } else if (impl.getState()==AsyncContextImpl.AsyncState.ERROR_DISPATCHING) {
+ async = false;
+ success = false;
+ connector.getContainer().getPipeline().getFirst().invoke(request, response);
} else {
try {
connector.getContainer().getPipeline().getFirst().invoke(request, response);
- }catch (RuntimeException x) {
- success = false;
- } finally {
+ } catch (RuntimeException x) {
+ impl.setErrorState(x);
}
}
}
}
boolean comet = false;
- boolean async = request.isAsyncStarted();
+ boolean async = false;
try {
if (asyncConImpl!=null && asyncConImpl.getState()==AsyncContextImpl.AsyncState.STARTED) {
res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
async = true;
- } else if (asyncConImpl!=null &&
- (asyncConImpl.getState()==AsyncContextImpl.AsyncState.DISPATCHING ||
- asyncConImpl.getState()==AsyncContextImpl.AsyncState.COMPLETING ||
- asyncConImpl.getState()==AsyncContextImpl.AsyncState.TIMING_OUT ||
- asyncConImpl.getState()==AsyncContextImpl.AsyncState.ERROR_DISPATCHING)) {
+ } else if (request.isAsyncDispatching()) {
asyncDispatch(req, res, SocketStatus.OPEN);
+ if (request.isAsyncStarted()) {
+ async = true;
+ res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
+ }
} else if (!comet) {
response.finishResponse();
req.action(ActionCode.ACTION_POST_REQUEST , null);
}
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (async) {
- if (error) {
- recycle();
- return SocketState.CLOSED;
- } else {
- return SocketState.LONG;
- }
+ if (error) {
+ recycle();
+ return SocketState.CLOSED;
+ } else if (async) {
+ return SocketState.LONG;
} else {
- if ( error || (!keepAlive)) {
+ if (!keepAlive) {
recycle();
return SocketState.CLOSED;
} else {
return SocketState.OPEN;
}
- }
+ }
}
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- if (async) {
- if (error) {
- recycle();
- return SocketState.CLOSED;
- } else {
- return SocketState.LONG;
- }
+ if (error) {
+ recycle();
+ return SocketState.CLOSED;
+ } else if (async) {
+ return SocketState.LONG;
} else {
- if ( error || (!keepAlive)) {
+ if (!keepAlive) {
recycle();
return SocketState.CLOSED;
} else {