Examples of bufferEntity()


Examples of javax.ws.rs.core.Response.bufferEntity()

    @Test
    // See JERSEY-1339
    public void testSecondBufferedRead() throws Exception {
        final Response response = target("response/string").request(MediaType.TEXT_PLAIN).get();
        response.bufferEntity();

        String entity;

        entity = response.readEntity(String.class);
        assertEquals(Resource.ENTITY, entity);
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    @Test
    public void bufferEntityTest() {
        Response response = Response.ok().build();
        response.close();
        try {
            response.bufferEntity();
            fail("IllegalStateException expected when reading entity after response has been closed.");
        } catch (IllegalStateException ex) {
            // expected
        }
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    }

    @Test
    public void testReadBufferedEntityAfterClose() {
        final Response response = target().path("simple").request().get(Response.class);
        response.bufferEntity();
        response.close();
        try {
            response.readEntity(String.class);
            fail("IllegalStateException expected when reading a buffered entity after response has been closed.");
        } catch (IllegalStateException ex) {
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    @Test
    public void testBufferEntityAfterClose() {
        final Response response = target().path("simple").request().get(Response.class);
        response.close();
        try {
            response.bufferEntity();
            fail("IllegalStateException expected when reading a buffered entity after response has been closed.");
        } catch (IllegalStateException ex) {
            // expected
        }
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

                && (r.getEntity() == null || InputStream.class.isAssignableFrom(r.getEntity().getClass())
                    && ((InputStream)r.getEntity()).available() == 0)) {
                return r;
            }
            if (PropertyUtils.isTrue(super.getConfiguration().getResponseContext().get(BUFFER_PROXY_RESPONSE))) {
                r.bufferEntity();
            }
           
            Class<?> returnType = method.getReturnType();
            Type genericType =
                InjectionUtils.processGenericTypeIfNeeded(serviceCls,
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    public void testGetCustomBookBufferedResponse() {
        String address = "http://localhost:" + PORT + "/bookstore/customresponse";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get(Response.class);
       
        r.bufferEntity();
       
        String bookStr = r.readEntity(String.class);
        assertTrue(bookStr.endsWith("</Book>"));
       
        Book book = r.readEntity(Book.class);
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    public void testGetCustomBookBufferedResponse() {
        String address = "http://localhost:" + PORT + "/bookstore/customresponse";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get(Response.class);
       
        r.bufferEntity();
       
        String bookStr = r.readEntity(String.class);
        assertTrue(bookStr.endsWith("</Book>"));
       
        Book book = r.readEntity(Book.class);
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

                && (r.getEntity() == null || InputStream.class.isAssignableFrom(r.getEntity().getClass())
                    && ((InputStream)r.getEntity()).available() == 0)) {
                return r;
            }
            if (PropertyUtils.isTrue(super.getConfiguration().getResponseContext().get(BUFFER_PROXY_RESPONSE))) {
                r.bufferEntity();
            }
           
            Class<?> returnType = method.getReturnType();
            Type genericType =
                InjectionUtils.processGenericTypeIfNeeded(serviceCls,
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    public void testGetCustomBookBufferedResponse() {
        String address = "http://localhost:" + PORT + "/bookstore/customresponse";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get(Response.class);
       
        r.bufferEntity();
       
        String bookStr = r.readEntity(String.class);
        assertTrue(bookStr.endsWith("</Book>"));
       
        Book book = r.readEntity(Book.class);
View Full Code Here

Examples of javax.ws.rs.core.Response.bufferEntity()

    public void testGetCustomBookBufferedResponse() {
        String address = "http://localhost:" + PORT + "/bookstore/customresponse";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get(Response.class);
       
        r.bufferEntity();
       
        String bookStr = r.readEntity(String.class);
        assertTrue(bookStr.endsWith("</Book>"));
       
        Book book = r.readEntity(Book.class);
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.