Package com.sun.jersey.multipart

Examples of com.sun.jersey.multipart.FormDataMultiPart.bodyPart()


                        .name("file")
                        .fileName(fileForImport.getFileName())
                        .size(fileForImport.getFile().length())
                        .build();
                FormDataBodyPart bodyPart = new FormDataBodyPart(dispo, fileForImport.getFile(), MediaType.MULTIPART_FORM_DATA_TYPE);
                mp.bodyPart(bodyPart);
            }
            postBody = mp;

            try {
                String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);
View Full Code Here


        .name("file")
        .fileName(file.getName())
        .size(file.length())
        .build();
      com.sun.jersey.multipart.FormDataBodyPart bodyPart = new com.sun.jersey.multipart.FormDataBodyPart(dispo, file, MediaType.MULTIPART_FORM_DATA_TYPE);
      mp.bodyPart(bodyPart);
      if(hasFields)
        postBody = mp;
    }
    else {
      formParams.put("visibilitySource", visibilitySource);}
View Full Code Here

        .name("file")
        .fileName(file.getName())
        .size(file.length())
        .build();
      com.sun.jersey.multipart.FormDataBodyPart bodyPart = new com.sun.jersey.multipart.FormDataBodyPart(dispo, file, MediaType.MULTIPART_FORM_DATA_TYPE);
      mp.bodyPart(bodyPart);
      if(hasFields)
        postBody = mp;
    }
    else {
      }
View Full Code Here

        IOUtils.toInputStream(html),
        // new FileInputStream(tmpHtml),
        MediaType.APPLICATION_OCTET_STREAM_TYPE);
   
    // attach the inputstream as upload info to the form
    form.bodyPart(fdp);
   
    // now post the form via the Internet/Intranet
    ClientResponse response = resource.type(MediaType.MULTIPART_FORM_DATA)
        .post(ClientResponse.class, form);
    // in debug mode show the response status
View Full Code Here

        builder = addApplicationKeyHeader(builder);
        if (platformParameters.requireResponseBody()) {
            builder.accept(mediaType);
        }
        FormDataMultiPart form = new FormDataMultiPart();
        form.bodyPart(new FormDataBodyPart("file", content, MediaType.APPLICATION_OCTET_STREAM_TYPE));
        return parseResponseWithoutId(responseClass, builder.post(ClientResponse.class, form), CREATED.getStatusCode());

    }

    public <T extends ResourceRepresentation> T putStream(String path, CumulocityMediaType mediaType, InputStream content,
View Full Code Here

        builder = addApplicationKeyHeader(builder);
        if (platformParameters.requireResponseBody()) {
            builder.accept(mediaType);
        }
        FormDataMultiPart form = new FormDataMultiPart();
        form.bodyPart(new FormDataBodyPart("file", content, MediaType.APPLICATION_OCTET_STREAM_TYPE));
        return parseResponseWithoutId(responseClass, builder.put(ClientResponse.class, form), OK.getStatusCode());
    }

    public <T extends ResourceRepresentationWithId> T put(String path, CumulocityMediaType mediaType,
            T representation) throws SDKException {
View Full Code Here

            throw new AppThwackException("file cannot be a directory");
        }

        FormDataMultiPart form = new FormDataMultiPart();
        form.field("name", name);
        form.bodyPart(new FileDataBodyPart("file", file, MediaType.APPLICATION_OCTET_STREAM_TYPE));

        return root.path("file").type(MediaType.MULTIPART_FORM_DATA).post(AppThwackFile.class, form);
    }
}
View Full Code Here

        final WebResource.Builder builder = client.resource(soda2ifyUri(uri))
                                                  .accept(acceptType)
                                                  .type(MediaType.MULTIPART_FORM_DATA_TYPE);

        FormDataMultiPart form = new FormDataMultiPart();
        form.bodyPart(new FileDataBodyPart(file.getName(), file, mediaType));

        final ClientResponse response = builder.post(ClientResponse.class, form);
        return processErrors(response);
    }
View Full Code Here

        final WebResource.Builder builder = client.resource(soda2ifyUri(uri))
                                                  .accept(acceptType)
                                                  .type(MediaType.MULTIPART_FORM_DATA_TYPE);

        FormDataMultiPart form = new FormDataMultiPart();
        form.bodyPart(new FileDataBodyPart(file.getName(), file, mediaType));

        final ClientResponse response = builder.put(ClientResponse.class, form);
        return processErrors(response);
    }
View Full Code Here

    public void testPart() {
        WebResource webResource = resource().path("form/part");

        FormDataMultiPart mp = new FormDataMultiPart();
        FormDataBodyPart p = new FormDataBodyPart(FormDataContentDisposition.name("part").build(), "CONTENT");
        mp.bodyPart(p);

        String s = webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(String.class, mp);
        Assert.assertEquals("CONTENT", s);
    }
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.