Package org.glassfish.jersey.server

Examples of org.glassfish.jersey.server.ContainerResponse


    public void testFormDefaultValueParamTypes() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormDefaultValueParamTypes.class);

        Form form = new Form();

        final ContainerResponse responseContext = apply(
                RequestContextBuilder.from("/", "POST").type(MediaType.APPLICATION_FORM_URLENCODED).entity(form).build()
        );

        assertEquals("1 3.14 3.14", responseContext.getEntity());
    }
View Full Code Here


    public void testFormConstructorValueParamTypes() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormConstructorValueParamTypes.class);

        Form form = new Form();

        final ContainerResponse responseContext = apply(
                RequestContextBuilder.from("/", "POST").type(MediaType.APPLICATION_FORM_URLENCODED).entity(form).build()
        );

        assertEquals("", responseContext.getEntity());
    }
View Full Code Here

        form.param("a", "<jaxbBean><value>a</value></jaxbBean>");
        form.param("b", "<jaxbBean><value>b1</value></jaxbBean>");
        form.param("b", "<jaxbBean><value>b2</value></jaxbBean>");


        final ContainerResponse responseContext = apply(RequestContextBuilder.from("/", "POST")
                .accept(MediaType.APPLICATION_XML)
                .type(MediaType.APPLICATION_FORM_URLENCODED)
                .entity(form)
                .build()
        );

        JAXBBean b = (JAXBBean) responseContext.getEntity();
        assertEquals("a", b.value);
    }
View Full Code Here

        Form form = new Form();
        form.param("a", "<x><value>a</value></jaxbBean>");
        form.param("b", "<x><value>b1</value></jaxbBean>");
        form.param("b", "<x><value>b2</value></jaxbBean>");

        final ContainerResponse responseContext = apply(
                RequestContextBuilder.from("/", "POST").type(MediaType.APPLICATION_FORM_URLENCODED).entity(form).build()
        );

        assertEquals(400, responseContext.getStatus());
    }
View Full Code Here

        Form form = new Form();
        form.param("a", date_RFC1123);
        form.param("b", date_RFC1036);
        form.param("c", date_ANSI_C);

        final ContainerResponse responseContext = apply(
                RequestContextBuilder.from("/", "POST").type(MediaType.APPLICATION_FORM_URLENCODED).entity(form).build()
        );

        assertEquals("POST", responseContext.getEntity());
    }
View Full Code Here

        _test("double", "3.14159265358979");
    }

    @Test
    public void testBadPrimitiveValue() throws Exception {
        ContainerResponse responseContext = app.apply(RequestContextBuilder.from("/int/abcdef", "GET").build()).get();
        assertEquals(404, responseContext.getStatus());
    }
View Full Code Here

        assertEquals(404, responseContext.getStatus());
    }

    @Test
    public void testBadPrimitiveWrapperValue() throws Exception {
        ContainerResponse responseContext = app.apply(RequestContextBuilder.from("/int/wrapper/abcdef", "GET").build()).get();
        assertEquals(404, responseContext.getStatus());
    }
View Full Code Here

    }

    @Test
    public void testImplicitProduces() throws Exception {
        final ApplicationHandler application = createApplication(ImplicitProducesResource.class);
        final ContainerResponse response = application.
                apply(RequestContextBuilder.from("/", "GET").accept(MediaType.TEXT_PLAIN_TYPE).build()).get();

        assertEquals("text/plain", response.getEntity());
        assertEquals("text-plain", response.getHeaderString("HEAD"));
    }
View Full Code Here

    @Test
    public void testBadDateResource() throws ExecutionException, InterruptedException {
        initiateWebApplication(BadDateResource.class);

        final ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/").queryParam("d",
                "123").build().toString());

        assertEquals(404, responseContext.getStatus());
    }
View Full Code Here

    @Test
    public void testBadEnumResource() throws ExecutionException, InterruptedException {
        initiateWebApplication(BadEnumResource.class);

        final ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/").queryParam("d",
                "123").build().toString());

        assertEquals(404, responseContext.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.server.ContainerResponse

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.