Examples of HttpUpgradeHandler


Examples of javax.servlet.http.HttpUpgradeHandler

        // Calls the protocol handler's init method if the request is marked to be upgraded
        if (request instanceof org.apache.catalina.connector.Request) {
            org.apache.catalina.connector.Request req = (org.apache.catalina.connector.Request) request;
            if (req.isUpgrade()) {
                HttpUpgradeHandler handler = req.getHttpUpgradeHandler();
                if (handler != null) {
                    WebConnectionImpl wc =
                            new WebConnectionImpl(
                                    req.getInputStream(),
                                    ((org.apache.catalina.connector.Response)req.getResponse()).getOutputStream());
                    wc.setRequest(req);
                    if (response instanceof org.apache.catalina.connector.Response) {
                        wc.setResponse((org.apache.catalina.connector.Response) response);
                    }
                    handler.init(wc);
                } else {
                    log.log(Level.SEVERE, PROTOCOL_HANDLER_REQUIRED_EXCEPTION);
                }
            }
        }
View Full Code Here

Examples of javax.servlet.http.HttpUpgradeHandler

    @Override
    public void close() throws Exception {
        // Make sure we run close logic only once
        if (isClosed.compareAndSet(false, true)) {
            if ((request != null) && (request.isUpgrade())) {
                HttpUpgradeHandler httpUpgradeHandler =
                        request.getHttpUpgradeHandler();
                try {
                    httpUpgradeHandler.destroy();
                    request.setUpgrade(false);
                    if (response != null) {
                        response.setUpgrade(false);
                    }
                } finally {
View Full Code Here

Examples of javax.servlet.http.HttpUpgradeHandler

        // Calls the protocol handler's init method if the request is marked to be upgraded
        if (request instanceof org.apache.catalina.connector.Request) {
            org.apache.catalina.connector.Request req = (org.apache.catalina.connector.Request) request;
            if (req.isUpgrade()) {
                HttpUpgradeHandler handler = req.getHttpUpgradeHandler();
                if (handler != null) {
                    WebConnectionImpl wc =
                            new WebConnectionImpl(
                                    req.getInputStream(),
                                    ((org.apache.catalina.connector.Response)req.getResponse()).getOutputStream());
                    wc.setRequest(req);
                    req.setWebConnection(wc);
                    if (response instanceof org.apache.catalina.connector.Response) {
                        wc.setResponse((org.apache.catalina.connector.Response) response);
                    }
                    handler.init(wc);
                } else {
                    log.log(Level.SEVERE, PROTOCOL_HANDLER_REQUIRED_EXCEPTION);
                }
            }
        }
View Full Code Here

Examples of javax.servlet.http.HttpUpgradeHandler

        // Calls the protocol handler's init method if the request is marked to be upgraded
        if (request instanceof org.apache.catalina.connector.Request) {
            org.apache.catalina.connector.Request req = (org.apache.catalina.connector.Request) request;
            if (req.isUpgrade()) {
                HttpUpgradeHandler handler = req.getHttpUpgradeHandler();
                if (handler != null) {
                    WebConnectionImpl wc =
                            new WebConnectionImpl(
                                    req.getInputStream(),
                                    ((org.apache.catalina.connector.Response)req.getResponse()).getOutputStream());
                    wc.setRequest(req);
                    req.setWebConnection(wc);
                    if (response instanceof org.apache.catalina.connector.Response) {
                        wc.setResponse((org.apache.catalina.connector.Response) response);
                    }
                    Context context = req.getContext();
                    try {
                        context.fireContainerEvent(ContainerEvent.BEFORE_UPGRADE_HANDLER_INITIALIZED, handler);
                        handler.init(wc);
                    } finally {
                        context.fireContainerEvent(ContainerEvent.AFTER_UPGRADE_HANDLER_INITIALIZED, handler);
                    }
                } else {
                    log.log(Level.SEVERE, PROTOCOL_HANDLER_REQUIRED_EXCEPTION);
View Full Code Here

Examples of javax.servlet.http.HttpUpgradeHandler

        }

        private void processError(final Throwable t) {
            synchronized(lk) {
                if (request.isUpgrade()) {
                    HttpUpgradeHandler httpUpgradeHandler =
                            request.getHttpUpgradeHandler();
                    try {
                        httpUpgradeHandler.destroy();
                    } finally {
                        ((StandardContext)request.getContext()).fireContainerEvent(
                            ContainerEvent.PRE_DESTROY, httpUpgradeHandler);
                    }
                    grizzlyRequest.getResponse().resume();
View Full Code Here

Examples of org.apache.coyote.http11.upgrade.servlet31.HttpUpgradeHandler

                        state = processor.asyncPostProcess();
                    }

                    if (state == SocketState.UPGRADING) {
                        // Get the HTTP upgrade handler
                        HttpUpgradeHandler httpUpgradeHandler =
                                processor.getHttpUpgradeHandler();
                        // Release the Http11 processor to be re-used
                        release(wrapper, processor, false, false);
                        // Create the upgrade processor
                        processor = createUpgradeProcessor(
                                wrapper, httpUpgradeHandler);
                        // Mark the connection as upgraded
                        wrapper.setUpgraded(true);
                        // Associate with the processor with the connection
                        connections.put(socket, processor);
                        // Initialise the upgrade handler (which may trigger
                        // some IO using the new protocol which is why the lines
                        // above are necessary)
                        // This cast should be safe. If it fails the error
                        // handling for the surrounding try/catch will deal with
                        // it.
                        httpUpgradeHandler.init((WebConnection) processor);
                    } else if (state == SocketState.UPGRADING_TOMCAT) {
                        // Get the UpgradeInbound handler
                        org.apache.coyote.http11.upgrade.UpgradeInbound inbound =
                                processor.getUpgradeInbound();
                        // Release the Http11 processor to be re-used
View Full Code Here

Examples of org.apache.coyote.http11.upgrade.servlet31.HttpUpgradeHandler

                        state = processor.asyncPostProcess();
                    }

                    if (state == SocketState.UPGRADING) {
                        // Get the HTTP upgrade handler
                        HttpUpgradeHandler httpUpgradeHandler =
                                processor.getHttpUpgradeHandler();
                        // Release the Http11 processor to be re-used
                        release(wrapper, processor, false, false);
                        // Create the upgrade processor
                        processor = createUpgradeProcessor(
                                wrapper, httpUpgradeHandler);
                        // Mark the connection as upgraded
                        wrapper.setUpgraded(true);
                        // Associate with the processor with the connection
                        connections.put(socket, processor);
                        // Initialise the upgrade handler (which may trigger
                        // some IO using the new protocol which is why the lines
                        // above are necessary)
                        // This cast should be safe. If it fails the error
                        // handling for the surrounding try/catch will deal with
                        // it.
                        httpUpgradeHandler.init((WebConnection) processor);
                    } else if (state == SocketState.UPGRADING_TOMCAT) {
                        // Get the UpgradeInbound handler
                        org.apache.coyote.http11.upgrade.UpgradeInbound inbound =
                                processor.getUpgradeInbound();
                        // Release the Http11 processor to be re-used
View Full Code Here

Examples of org.apache.coyote.http11.upgrade.servlet31.HttpUpgradeHandler

                        state = processor.asyncPostProcess();
                    }

                    if (state == SocketState.UPGRADING) {
                        // Get the HTTP upgrade handler
                        HttpUpgradeHandler httpUpgradeHandler =
                                processor.getHttpUpgradeHandler();
                        // Release the Http11 processor to be re-used
                        release(wrapper, processor, false, false);
                        // Create the upgrade processor
                        processor = createUpgradeProcessor(
                                wrapper, httpUpgradeHandler);
                        // Mark the connection as upgraded
                        wrapper.setUpgraded(true);
                        // Associate with the processor with the connection
                        connections.put(socket, processor);
                        // Initialise the upgrade handler (which may trigger
                        // some IO using the new protocol which is why the lines
                        // above are necessary)
                        // This cast should be safe. If it fails the error
                        // handling for the surrounding try/catch will deal with
                        // it.
                        httpUpgradeHandler.init((WebConnection) processor);
                    } else if (state == SocketState.UPGRADING_TOMCAT) {
                        // Get the UpgradeInbound handler
                        org.apache.coyote.http11.upgrade.UpgradeInbound inbound =
                                processor.getUpgradeInbound();
                        // Release the Http11 processor to be re-used
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.