Package org.apache.http.nio.protocol

Examples of org.apache.http.nio.protocol.AsyncHttpService$ContentOutputStream


            // Allocate large content input / output buffers
            ContentInputBuffer inbuffer = new ContentInputBuffer(20480, conn);
            ContentOutputBuffer outbuffer = new ContentOutputBuffer(20480, conn);
           
            // Set up the HTTP service
            AsyncHttpService httpService = new AsyncHttpService(
                    inbuffer,
                    outbuffer,
                    httpproc,
                    new DefaultConnectionReuseStrategy(),
                    new DefaultHttpResponseFactory());
            httpService.setParams(this.params);
            httpService.setHandlerResolver(this.reqistry);
           
            conn.getContext().setAttribute(HTTP_ASYNC_SERVICE, httpService);
        }
View Full Code Here


           
            conn.getContext().setAttribute(HTTP_ASYNC_SERVICE, httpService);
        }

        public void closed(final NHttpServerConnection conn) {
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            httpService.shutdown();
        }
View Full Code Here

                .getAttribute(HTTP_ASYNC_SERVICE);
            httpService.shutdown();
        }

        public void exception(final NHttpServerConnection conn, final HttpException httpex) {
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            try {
                httpService.handleException(conn, httpex);
            } catch (IOException ex) {
                httpService.shutdown(ex);
                shutdownConnection(conn);
            } catch (HttpException ex) {
                System.err.println("Unexpected HTTP protocol error: " + ex.getMessage());
                httpService.shutdown();
                shutdownConnection(conn);
            }
        }
View Full Code Here

                shutdownConnection(conn);
            }
        }

        public void exception(final NHttpServerConnection conn, final IOException ioex) {
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            httpService.shutdown(ioex);
            shutdownConnection(conn);
        }
View Full Code Here

            exception(conn, new SocketTimeoutException("Socket timeout"));
        }

        public void requestReceived(final NHttpServerConnection conn) {
            HttpRequest request = conn.getHttpRequest();
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            WorkerThread worker = (WorkerThread) conn.getContext()
                .getAttribute(HTTP_WORKER_THREAD);
           
            // BIG FAT UGLY WARNING!
View Full Code Here

            worker.setDaemon(true);
            worker.start();
        }

        public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) {
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            try {
                httpService.consumeContent(decoder);
            } catch (IOException ex) {
                httpService.shutdown(ex);
                shutdownConnection(conn);
            }
        }
View Full Code Here

                shutdownConnection(conn);
            }
        }

        public void outputReady(NHttpServerConnection conn, ContentEncoder encoder) {
            AsyncHttpService httpService = (AsyncHttpService) conn.getContext()
                .getAttribute(HTTP_ASYNC_SERVICE);
            try {
                httpService.produceContent(encoder);
            } catch (IOException ex) {
                httpService.shutdown(ex);
                shutdownConnection(conn);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.http.nio.protocol.AsyncHttpService$ContentOutputStream

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.