Package com.sun.jersey.multipart

Examples of com.sun.jersey.multipart.FormDataMultiPart


            this.name = name;
        }

        @Override
        public List<FormDataBodyPart> getValue(HttpContext context) {
            FormDataMultiPart fdmp = (FormDataMultiPart)
                    context.getProperties().get(FORM_MULTIPART_PROPERTY);

            return fdmp.getFields(name);
        }
View Full Code Here


            this.name = name;
        }

        @Override
        public FormDataContentDisposition getValue(HttpContext context) {
            FormDataMultiPart fdmp = (FormDataMultiPart)
                    context.getProperties().get(FORM_MULTIPART_PROPERTY);

            FormDataBodyPart fdbp = fdmp.getField(name);
            if (fdbp == null)
                return null;
           
            return fdmp.getField(name).getFormDataContentDisposition();
        }
View Full Code Here

            this.name = name;
        }

        @Override
        public List<FormDataContentDisposition> getValue(HttpContext context) {
            FormDataMultiPart fdmp = (FormDataMultiPart)
                    context.getProperties().get(FORM_MULTIPART_PROPERTY);

            List<FormDataBodyPart> fdbps = fdmp.getFields(name);
            if (fdbps == null)
                return null;

            List<FormDataContentDisposition> l = new ArrayList<FormDataContentDisposition>(fdbps.size());
            for (FormDataBodyPart fdbp : fdbps) {
View Full Code Here

        @Override
        public Object getValue(HttpContext context) {
            // Return the field value for the field specified by the
            // sourceName property
            FormDataMultiPart fdmp = (FormDataMultiPart)
                    context.getProperties().get(FORM_MULTIPART_PROPERTY);
           
            List<FormDataBodyPart> fdbps = fdmp.getFields(param.getSourceName());
            FormDataBodyPart fdbp = (fdbps != null) ? fdbps.get(0) : null;

            MediaType mediaType = (fdbp != null)
                    ? fdbp.getMediaType() : MediaType.TEXT_PLAIN_TYPE;
View Full Code Here

        MIMEMessage mm = new MIMEMessage(stream, mediaType.getParameters().get("boundary"), mimeConfig);

        boolean formData = false;
        MultiPart multiPart;
        if (MediaTypes.typeEquals(mediaType, MediaType.MULTIPART_FORM_DATA_TYPE)) {
            multiPart = new FormDataMultiPart();
            formData = true;
        } else {
            multiPart = new MultiPart();
        }
View Full Code Here

        startServer(ProducesFormDataResource.class, MultiPartBeanProvider.class);

        WebResource.Builder builder = client.resource(getUri()).
                accept("multipart/form-data");
        try {
            FormDataMultiPart result = builder.get(FormDataMultiPart.class);
            checkMediaType(new MediaType("multipart", "form-data"), result.getMediaType());
            assertEquals(3, result.getFields().size());
            assertNotNull(result.getField("foo"));
            assertEquals("bar", result.getField("foo").getValue());
            assertNotNull(result.getField("baz"));
            assertEquals("bop", result.getField("baz").getValue());
            assertNotNull(result.getField("bean"));
            MultiPartBean bean = result.getField("bean").getValueAs(MultiPartBean.class);
            assertNotNull(bean);
            assertEquals("myname", bean.getName());
            assertEquals("myvalue", bean.getValue());
            result.cleanup();
        } catch (UniformInterfaceException e) {
            report(e);
            fail("Caught exception: " + e);
        }
    }
View Full Code Here

                "ISO-8859-1",
                "UTF-8",
                "UTF-16BE",
                "UTF-16LE",
                "UTF-16")) {
            FormDataMultiPart p = client.resource(getUri()).path("/").
                    queryParam("charset", charset).
                    accept("multipart/form-data").
                    get(FormDataMultiPart.class);

            String expected = new String(c.getBytes(charset), charset);
            assertEquals(expected, p.getField("foo").getValue());
        }
    }
View Full Code Here

        WebResource.Builder builder = client.resource(getUri()).
                accept("text/plain").type("multipart/form-data");
        try {
            MultiPartBean bean = new MultiPartBean("myname", "myvalue");
            FormDataMultiPart entity = new FormDataMultiPart().
                field("foo", "bar").
                field("baz", "bop").
                field("bean", bean, new MediaType("x-application", "x-format"));
            String response = builder.put(String.class, entity);
            if (!response.startsWith("SUCCESS:")) {
View Full Code Here

        WebResource.Builder builder = client.resource(getUri()).
                accept("text/plain").type("multipart/form-data");
        try {
            MultiPartBean bean = new MultiPartBean("myname", "myvalue");
            FormDataMultiPart entity = new FormDataMultiPart().
                field("foo", "bar").
                field("baz", "bop").
                field("bean", bean, new MediaType("x-application", "x-format"));
            String response = builder.put(String.class, entity);
            if (!response.startsWith("SUCCESS:")) {
View Full Code Here

        startServer(FormDataTypesResource.class, MultiPartBeanProvider.class);

        WebResource.Builder builder = client.resource(getUri()).
                accept("text/plain").type("multipart/form-data");
        try {
            FormDataMultiPart entity = new FormDataMultiPart().
                field("foo", "bar").
                field("baz", "bop");
            String response = builder.put(String.class, entity);
            assertEquals("OK", response);
        } catch (UniformInterfaceException e) {
View Full Code Here

TOP

Related Classes of com.sun.jersey.multipart.FormDataMultiPart

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.