private final boolean isInvokeOnMessageReceived;
private final boolean isContinueHandler;
public RequestHandlerAdapter(IHttpRequestHandler delegate) {
RequestHandlerInfo handlerInfo = HttpUtils.getRequestHandlerInfo(delegate);
isInvokeOnMessageReceived = handlerInfo.isRequestHandlerInvokeOnMessageReceived();
isContinueHandler = handlerInfo.isContinueHandler();
// wrapping request timeout handler
if (handlerInfo.isRequestTimeoutHandler()) {
if (handlerInfo.isUnsynchronized()) {
requestTimeoutHandler = (IHttpRequestTimeoutHandler) delegate;
} else if (handlerInfo.isRequestTimeoutHandlerMultithreaded()) {
requestTimeoutHandler = new MultithreadedRequestTimeoutHandlerAdapter((IHttpRequestTimeoutHandler) delegate);
} else {
requestTimeoutHandler = new NonthreadedRequestTimeoutHandlerAdapter((IHttpRequestTimeoutHandler) delegate);
}
} else {
requestTimeoutHandler = new EmptyRequestTimeoutHandlerAdapter();
}
// wrap session-scope request handler
if (handlerInfo.isRequestHandlerSynchronizedOnSession()) {
delegate = new SessionSynchronizedRequestHandlerAdapter(delegate);
}
// wrap threaded request handler
if (handlerInfo.isRequestHandlerSynchronizedOnSession()) {
requestHandler = new MultithreadedRequestHandlerAdapter(delegate);
} else if (handlerInfo.isUnsynchronized()) {
requestHandler = delegate;
} else if (handlerInfo.isRequestHandlerMultithreaded()) {
requestHandler = new MultithreadedRequestHandlerAdapter(delegate);
} else {
requestHandler = new NonthreadedRequestHandlerAdapter(delegate);
}