Examples of AsyncContextImpl


Examples of org.apache.catalina.core.AsyncContextImpl

        if (!isAsyncSupported()) {
            throw new IllegalStateException("Not supported.");
        }

        if (asyncContext == null) {
            asyncContext = new AsyncContextImpl(this);
        }

        asyncContext.setStarted(getContext(), request, response,
                request==getRequest() && response==getResponse().getResponse());
        asyncContext.setTimeout(getConnector().getAsyncTimeout());
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

            throw new IllegalStateException(
                    "Dispatch may only happen on an existing request.");
        }
        boolean comet = false;
        boolean success = true;
        AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
        req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
        try {
            if (!request.isAsync() && !comet) {
                // Error or timeout - need to tell listeners the request is over
                // Have to test this first since state may change while in this
                // method and this is only required if entering this method in
                // this state
                Context ctxt = (Context) request.getMappingData().context;
                if (ctxt != null) {
                    ctxt.fireRequestDestroyEvent(request);
                }
                // Lift any suspension (e.g. if sendError() was used by an async
                // request) to allow the response to be written to the client
                response.setSuspended(false);
            }

            if (status==SocketStatus.TIMEOUT) {
                success = true;
                if (!asyncConImpl.timeout()) {
                    asyncConImpl.setErrorState(null);
                }
            }
            if (request.isAsyncDispatching()) {
                success = true;
                connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                Throwable t = (Throwable) request.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                if (t != null) {
                    asyncConImpl.setErrorState(t);
                }
            }

            if (request.isComet()) {
                if (!response.isClosed() && !response.isError()) {
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

                        request.setFilterChain(null);
                    }
                }

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
            } else if (!comet) {
                request.finishRequest();
                response.finishResponse();
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

        if (!isAsyncSupported()) {
            throw new IllegalStateException("Not supported.");
        }
       
        if (asyncContext == null) {
            asyncContext = new AsyncContextImpl(this);
        }
       
        asyncContext.setStarted(getContext(), request, response,
                request==getRequest() && response==getResponse().getResponse());
        asyncContext.setTimeout(getConnector().getAsyncTimeout());
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

            throw new IllegalStateException(
                    "Dispatch may only happen on an existing request.");
        }
        boolean comet = false;
        boolean success = true;
        AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
        try {
            if (!request.isAsync() && !comet) {
                // Error or timeout - need to tell listeners the request is over
                // Have to test this first since state may change while in this
                // method and this is only required if entering this methos in
                // this state
                Context ctxt = (Context) request.getMappingData().context;
                if (ctxt != null) {
                    ctxt.fireRequestDestroyEvent(request);
                }
            }

            if (status==SocketStatus.TIMEOUT) {
                success = true;
                if (!asyncConImpl.timeout()) {
                    asyncConImpl.setErrorState(null);
                }
            }
            if (request.isAsyncDispatching()) {
                success = true;
                connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                Throwable t = (Throwable) request.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                if (t != null) {
                    asyncConImpl.setErrorState(t);
                }
            }

            if (request.isComet()) {
                if (!response.isClosed() && !response.isError()) {
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

                        request.setFilterChain(null);
                    }
                }

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
            } else if (!comet) {
                request.finishRequest();
                response.finishResponse();
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

        boolean async = false;
        boolean success = true;
       
        try {
            if (status==SocketStatus.TIMEOUT) {
                AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
                //TODO SERVLET3 - async
                //configure settings for timed out
                asyncConImpl.setTimeoutState();
            }
            if (status==SocketStatus.ERROR || status==SocketStatus.DISCONNECT) {
                AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
                //TODO SERVLET3 - async
                //configure settings for timed out
                asyncConImpl.setErrorState(new IOException("Socket error."));
            }
            while (success) {
                AsyncContextImpl impl = (AsyncContextImpl)request.getAsyncContext();
                    // Calling the container
                if (impl.getState()==AsyncContextImpl.AsyncState.DISPATCHED) {
                    // Calling the container
                    try {
                        impl.complete();
                        connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                    } finally {
                        success = false;
                    }
                } else if (impl.getState()==AsyncContextImpl.AsyncState.STARTED){
                    //TODO SERVLET3 - async
                    res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
                    async = true;
                    break;
                } else if (impl.getState()==AsyncContextImpl.AsyncState.NOT_STARTED){
                    //TODO SERVLET3 - async
                    async = false;
                    break;
                } else if (impl.getState()==AsyncContextImpl.AsyncState.ERROR_DISPATCHING) {
                    async = false;
                    success = false;
                    connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                } else {
                    try {
                        connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
                    } catch (RuntimeException x) {
                        impl.setErrorState(x);
                    }
                }
            }
           
            if (request.isComet()) {
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

                        request.setFilterChain(null);
                    }
                }

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl!=null && asyncConImpl.getState()==AsyncContextImpl.AsyncState.STARTED) {
                res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
                async = true;
            } else if (request.isAsyncDispatching()) {
                asyncDispatch(req, res, SocketStatus.OPEN);
                if (request.isAsyncStarted()) {
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

        if (!isAsyncSupported()) {
            throw new IllegalStateException("Not supported.");
        }
       
        if (asyncContext==null) {
            asyncContext = new AsyncContextImpl(this);
        } else if (asyncContext.isStarted()) {
            throw new IllegalStateException("Already started.");
        }
       
        asyncContext.setStarted(getContext());
View Full Code Here

Examples of org.apache.catalina.core.AsyncContextImpl

        if (!isAsyncSupported()) {
            throw new IllegalStateException("Not supported.");
        }
       
        if (asyncContext == null) {
            asyncContext = new AsyncContextImpl(this);
        }
       
        asyncContext.setStarted(getContext(), request, response,
                request==getRequest() && response==getResponse().getResponse());
        asyncContext.setTimeout(getConnector().getAsyncTimeout());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.