Package javax.ws.rs.core

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


    }

    @Test
    public void testResourceAsHtmlIso88592() throws Exception {
        final Response response = item1resource().path("iso").request().get();
        response.bufferEntity();

        final String htmlUtf8 = response.readEntity(String.class);

        assertItemHtmlResponse(htmlUtf8);
        assertFalse("Response shouldn't contain Ha\u0161ek but was: " + htmlUtf8, htmlUtf8.contains("Ha\u0161ek"));
View Full Code Here

        });
        final Response response = target.request().buildGet().invoke();

        try {
            response.bufferEntity();
        } catch (ProcessingException mpe) {
            // OK
            return;
        }
View Full Code Here

    @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

    @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

    }

    @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

    @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

                && (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

    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

    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.