Package com.ning.http.client

Examples of com.ning.http.client.HttpResponseBodyPart


                @Override
                public FluentCaseInsensitiveStringsMap getHeaders() {
                    return new FluentCaseInsensitiveStringsMap();
                }
            });
            handler.onBodyPartReceived(new HttpResponseBodyPart(uri, this) {
                @Override
                public byte[] getBodyPartBytes() {
                    return expectation.getPayload().getBytes(Charset.forName("UTF-8"));
                }
View Full Code Here


    public void close() {
    }

    @Override
    public Response prepareResponse(final HttpResponseStatus status, final HttpResponseHeaders headers, final List<HttpResponseBodyPart> bodyParts) {
        final HttpResponseBodyPart bodyPart = bodyParts.get(0);
        return new Response() {
            @Override
            public int getStatusCode() {
                return status.getStatusCode();
            }

            @Override
            public String getStatusText() {
                return status.getStatusText();
            }

            @Override
            public byte[] getResponseBodyAsBytes() throws IOException {
                return bodyPart.getBodyPartBytes();
            }

            @Override
            public ByteBuffer getResponseBodyAsByteBuffer() throws IOException {
                return bodyPart.getBodyByteBuffer();
            }

            @Override
            public InputStream getResponseBodyAsStream() throws IOException {
                return null; // TODO
            }

            @Override
            public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException {
                return ""; // TODO
            }

            @Override
            public String getResponseBody(String charset) throws IOException {
                return new String(bodyPart.getBodyPartBytes(), charset);
            }

            @Override
            public String getResponseBodyExcerpt(int maxLength) throws IOException {
                return null; // TODO
            }

            @Override
            public String getResponseBody() throws IOException {
                return new String(bodyPart.getBodyPartBytes());
            }

            @Override
            public URI getUri() throws MalformedURLException {
                return status.getUrl();
View Full Code Here

TOP

Related Classes of com.ning.http.client.HttpResponseBodyPart

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.