Package javax.ws.rs.core

Examples of javax.ws.rs.core.Form


            assertEquals(contactBean, response.readEntity(ContactBean.class));
        }
    }

    private void testSubResourceNegative(final String path) throws Exception {
        final Form form = new Form();
        form.asMap().put("foo", Arrays.asList("bar"));

        final Response response = testSubResource(path, form);

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


        testSubResourceNegative("nullResourceContextInstance");
    }

    @Test
    public void testSubResourceEmptyNames() throws Exception {
        final Form form = new Form();
        form.asMap().put("firstName", Arrays.asList(""));
        form.asMap().put("lastName", Arrays.asList(""));

        final Response response = testSubResource("nullResourceContextInstance", form);

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

                        header("x", " 123").
                        build()
        );
        assertEquals("header", responseContext.getEntity());

        Form f = new Form();
        f.param("x", " 123");
        responseContext = apply(
                RequestContextBuilder.from("/form", "POST").
                        type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).
                        entity(f).
                        build()
View Full Code Here

                        header("x", " 123").
                        build()
        );
        assertEquals("param", responseContext.getEntity());

        Form f = new Form();
        f.param("x", " 123");
        responseContext = apply(
                RequestContextBuilder.from("/form", "POST").
                        type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).
                        entity(f).
                        build()
View Full Code Here

    @Test
    public void testSimpleFormResource() throws ExecutionException, InterruptedException {
        initiateWebApplication(SimpleFormResource.class);

        Form form = new Form();
        form.param("a", "foo");

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

    @Test
    public void testSimpleFormResourceWithCharset() throws ExecutionException, InterruptedException {
        initiateWebApplication(SimpleFormResource.class);

        Form form = new Form();
        form.param("a", "foo");

        final ContainerResponse responseContext = apply(RequestContextBuilder.from("/", "POST")
                .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE.withCharset("UTF-8"))
                .entity(form)
                .build()
View Full Code Here

    @Test
    public void testFormResourceNoConsumes() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormResourceNoConsumes.class);

        Form form = new Form();
        form.param("a", "foo");

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

    @Test
    public void testFormResourceFormEntityParam() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormResourceFormEntityParam.class);

        Form form = new Form();
        form.param("a", "foo");

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

    @Test
    public void testFormParamX() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormResourceX.class);

        Form form = new Form();
        form.param("a", "foo");
        form.param("b", "bar");

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

    @Test
    public void testFormParamY() throws ExecutionException, InterruptedException {
        initiateWebApplication(FormResourceY.class);

        Form form = new Form();
        form.param("a", "foo");
        form.param("b", "bar");

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

TOP

Related Classes of javax.ws.rs.core.Form

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.