Package org.apache.http.nio.util

Examples of org.apache.http.nio.util.HeapByteBufferAllocator


                this.sslHandler);

        LoggingNHttpClientConnection conn = new LoggingNHttpClientConnection(
                new LoggingIOSession(sslSession),
                new DefaultHttpResponseFactory(),
                new HeapByteBufferAllocator(),
                this.params);

        session.setAttribute(NHTTP_CONN, conn);
        session.setAttribute(SSL_SESSION, sslSession);
View Full Code Here


    public void connected(final IOSession session) {
        // Decorate I/O session with logging capabilities
        LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection(
                new LoggingIOSession(session),
                new DefaultHttpRequestFactory(),
                new HeapByteBufferAllocator(),
                this.params);
        session.setAttribute(NHTTP_CONN, conn);
        this.handler.connected(conn);
    }
View Full Code Here

    public SessionOutputBufferImpl(
            int buffersize,
            int linebuffersize,
            final HttpParams params) {
        this(buffersize, linebuffersize, new HeapByteBufferAllocator(), params);
    }
View Full Code Here

            final HttpProcessor httpProcessor,
            final HttpResponseFactory responseFactory,
            final ConnectionReuseStrategy connStrategy,
            final HttpParams params) {
        this(httpProcessor, responseFactory, connStrategy,
                new HeapByteBufferAllocator(), params);
    }
View Full Code Here

        public ConsumingNHttpEntity entityRequest(
                final HttpEntityEnclosingRequest request,
                final HttpContext context) throws HttpException, IOException {
            return new BufferingNHttpEntity(
                    request.getEntity(),
                    new HeapByteBufferAllocator());
        }
View Full Code Here

            final HttpProcessor httpProcessor,
            final HttpResponseFactory responseFactory,
            final ConnectionReuseStrategy connStrategy,
            final HttpParams params) {
        this(httpProcessor, responseFactory, connStrategy,
                new HeapByteBufferAllocator(), params);
    }
View Full Code Here

            final HttpProcessor httpProcessor,
            final HttpResponseFactory responseFactory,
            final ConnectionReuseStrategy connStrategy,
            final HttpParams params) {
        this(httpProcessor, responseFactory, connStrategy,
                new HeapByteBufferAllocator(), params);
    }
View Full Code Here

            final HttpProcessor httpProcessor,
            final HttpRequestExecutionHandler execHandler,
            final ConnectionReuseStrategy connStrategy,
            final HttpParams params) {
        this(httpProcessor, execHandler, connStrategy,
                new HeapByteBufferAllocator(), params);
    }
View Full Code Here

        public ConsumingNHttpEntity responseEntity(
                final HttpResponse response,
                final HttpContext context) throws IOException {
            return new BufferingNHttpEntity(
                    response.getEntity(),
                    new HeapByteBufferAllocator());
        }
View Full Code Here

            public ConsumingNHttpEntity entityRequest(
                    final HttpEntityEnclosingRequest request,
                    final HttpContext context) throws HttpException, IOException {
                return new BufferingNHttpEntity(
                        request.getEntity(),
                        new HeapByteBufferAllocator());
            }

            @Override
            public void handle(
                    final HttpRequest request,
                    final HttpResponse response,
                    final HttpContext context) throws HttpException, IOException {
                if (request instanceof HttpEntityEnclosingRequest) {
                    HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity();
                    byte[] b = EntityUtils.toByteArray(entity);
                    NByteArrayEntity outgoing = new NByteArrayEntity(b);
                    outgoing.setChunked(false);
                    response.setEntity(outgoing);
                } else {
                    NStringEntity outgoing = new NStringEntity("No content");
                    response.setEntity(outgoing);
                }
            }
        };

        // Set protocol level to HTTP/1.0
        this.client.getParams().setParameter(
                CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0);

        NHttpRequestExecutionHandler requestExecutionHandler = new NHttpRequestExecutionHandler() {

            public void initalizeContext(final HttpContext context, final Object attachment) {
                context.setAttribute("LIST", attachment);
                context.setAttribute("REQ-COUNT", Integer.valueOf(0));
                context.setAttribute("RES-COUNT", Integer.valueOf(0));
            }

            public void finalizeContext(final HttpContext context) {
            }

            public ConsumingNHttpEntity responseEntity(
                    final HttpResponse response,
                    final HttpContext context) throws IOException {
                return new BufferingNHttpEntity(response.getEntity(),
                        new HeapByteBufferAllocator());
            }

            public HttpRequest submitRequest(final HttpContext context) {
                int i = ((Integer) context.getAttribute("REQ-COUNT")).intValue();
                BasicHttpEntityEnclosingRequest post = null;
View Full Code Here

TOP

Related Classes of org.apache.http.nio.util.HeapByteBufferAllocator

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.