Package javax.servlet

Examples of javax.servlet.ReadListener


                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        readListener.onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            } else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
                // A async write error is an IO error which means the socket
                // needs to be closed so set success to false to trigger a
                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                if (res.getWriteListener() != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.getWriteListener().onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            }

            // Check to see if non-blocking writes or reads are being used
            if (!request.isAsyncDispatching() && request.isAsync()) {
                WriteListener writeListener = res.getWriteListener();
                ReadListener readListener = req.getReadListener();
                if (writeListener != null && status == SocketStatus.OPEN_WRITE) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.onWritePossible();
                        if (request.isFinished() && req.sendAllDataReadEvent() &&
                                readListener != null) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        writeListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
                } else if (readListener != null && status == SocketStatus.OPEN_READ) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        // If data is being read on a non-container thread a
                        // dispatch with status OPEN_READ will be used to get
                        // execution back on a container thread for the
                        // onAllDataRead() event. Therefore, make sure
                        // onDataAvailable() is not called in this case.
                        if (!request.isFinished()) {
                            readListener.onDataAvailable();
                        }
                        if (request.isFinished() && req.sendAllDataReadEvent()) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        readListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
View Full Code Here


            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
                ReadListener readListener = req.getReadListener();
                if (readListener != null && request.isFinished()) {
                    // Possible the all data may have been read during service()
                    // method so this needs to be checked here
                    ClassLoader oldCL = null;
                    try {
View Full Code Here

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    // Possible the all data may have been read during service()
                    // method so this needs to be checked here
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
View Full Code Here

                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
                    ClassLoader newCL =
                            request.getContext().getLoader().getClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(newCL);
                        readListener.onError(t);
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            } else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
                // A async write error is an IO error which means the socket
                // needs to be closed so set success to false to trigger a
                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                if (res.getWriteListener() != null) {
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
                    ClassLoader newCL =
                            request.getContext().getLoader().getClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(newCL);
                        res.getWriteListener().onError(t);
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            }

            // Check to see if non-blocking writes or reads are being used
            if (!request.isAsyncDispatching() && request.isAsync()) {
                WriteListener writeListener = res.getWriteListener();
                ReadListener readListener = req.getReadListener();
                if (writeListener != null && status == SocketStatus.OPEN_WRITE) {
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
                    ClassLoader newCL =
                            request.getContext().getLoader().getClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(newCL);
                        res.onWritePossible();
                        if (request.isFinished() && req.sendAllDataReadEvent() &&
                                readListener != null) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        writeListener.onError(t);
                        throw t;
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldCL);
                    }
                    success = true;
                } else if (readListener != null && status == SocketStatus.OPEN_READ) {
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
                    ClassLoader newCL =
                            request.getContext().getLoader().getClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(newCL);
                        readListener.onDataAvailable();
                        if (request.isFinished() && req.sendAllDataReadEvent()) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        readListener.onError(t);
                        throw t;
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldCL);
                    }
                    success = true;
View Full Code Here

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
                ReadListener readListener = req.getReadListener();
                if (readListener != null && request.isFinished()) {
                    // Possible the all data may have been read during service()
                    // method so this needs to be checked here
                    ClassLoader oldCL =
                            Thread.currentThread().getContextClassLoader();
View Full Code Here

                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        readListener.onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            } else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
                // A async write error is an IO error which means the socket
                // needs to be closed so set success to false to trigger a
                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                if (res.getWriteListener() != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.getWriteListener().onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            }

            // Check to see if non-blocking writes or reads are being used
            if (!request.isAsyncDispatching() && request.isAsync()) {
                WriteListener writeListener = res.getWriteListener();
                ReadListener readListener = req.getReadListener();
                if (writeListener != null && status == SocketStatus.OPEN_WRITE) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.onWritePossible();
                        if (request.isFinished() && req.sendAllDataReadEvent() &&
                                readListener != null) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        writeListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
                } else if (readListener != null && status == SocketStatus.OPEN_READ) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        // If data is being read on a non-container thread a
                        // dispatch with status OPEN_READ will be used to get
                        // execution back on a container thread for the
                        // onAllDataRead() event. Therefore, make sure
                        // onDataAvailable() is not called in this case.
                        if (!request.isFinished()) {
                            readListener.onDataAvailable();
                        }
                        if (request.isFinished() && req.sendAllDataReadEvent()) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        readListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
View Full Code Here

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
                ReadListener readListener = req.getReadListener();
                if (readListener != null && request.isFinished()) {
                    // Possible the all data may have been read during service()
                    // method so this needs to be checked here
                    ClassLoader oldCL = null;
                    try {
View Full Code Here

                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        readListener.onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            } else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
                // A async write error is an IO error which means the socket
                // needs to be closed so set success to false to trigger a
                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                if (res.getWriteListener() != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.getWriteListener().onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            }

            // Check to see if non-blocking writes or reads are being used
            if (!request.isAsyncDispatching() && request.isAsync()) {
                WriteListener writeListener = res.getWriteListener();
                ReadListener readListener = req.getReadListener();
                if (writeListener != null && status == SocketStatus.OPEN_WRITE) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.onWritePossible();
                        if (request.isFinished() && req.sendAllDataReadEvent() &&
                                readListener != null) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        writeListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
                } else if (readListener != null && status == SocketStatus.OPEN_READ) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        readListener.onDataAvailable();
                        if (request.isFinished() && req.sendAllDataReadEvent()) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        readListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
View Full Code Here

            }
            AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
            if (asyncConImpl != null) {
                async = true;
                ReadListener readListener = req.getReadListener();
                if (readListener != null && request.isFinished()) {
                    // Possible the all data may have been read during service()
                    // method so this needs to be checked here
                    ClassLoader oldCL = null;
                    try {
View Full Code Here

                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                ReadListener readListener = req.getReadListener();
                if (readListener != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        readListener.onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            } else if (status==SocketStatus.ASYNC_WRITE_ERROR) {
                // A async write error is an IO error which means the socket
                // needs to be closed so set success to false to trigger a
                // close
                success = false;
                Throwable t = (Throwable)req.getAttribute(
                        RequestDispatcher.ERROR_EXCEPTION);
                req.getAttributes().remove(RequestDispatcher.ERROR_EXCEPTION);
                if (res.getWriteListener() != null) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.getWriteListener().onError(t);
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                }
                if (t != null) {
                    asyncConImpl.setErrorState(t, true);
                }
            }

            // Check to see if non-blocking writes or reads are being used
            if (!request.isAsyncDispatching() && request.isAsync()) {
                WriteListener writeListener = res.getWriteListener();
                ReadListener readListener = req.getReadListener();
                if (writeListener != null && status == SocketStatus.OPEN_WRITE) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        res.onWritePossible();
                        if (request.isFinished() && req.sendAllDataReadEvent() &&
                                readListener != null) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        writeListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
                } else if (readListener != null && status == SocketStatus.OPEN_READ) {
                    ClassLoader oldCL = null;
                    try {
                        oldCL = request.getContext().bind(false, null);
                        // If data is being read on a non-container thread a
                        // dispatch with status OPEN_READ will be used to get
                        // execution back on a container thread for the
                        // onAllDataRead() event. Therefore, make sure
                        // onDataAvailable() is not called in this case.
                        if (!request.isFinished()) {
                            readListener.onDataAvailable();
                        }
                        if (request.isFinished() && req.sendAllDataReadEvent()) {
                            readListener.onAllDataRead();
                        }
                    } catch (Throwable t) {
                        ExceptionUtils.handleThrowable(t);
                        readListener.onError(t);
                        throw t;
                    } finally {
                        request.getContext().unbind(false, oldCL);
                    }
                    success = true;
View Full Code Here

TOP

Related Classes of javax.servlet.ReadListener

Copyright © 2018 www.massapicom. 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.