Examples of FormDataMultiPart


Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      hasFields = true;
      mp.field("data", data, MediaType.MULTIPART_FORM_DATA_TYPE);
      if(hasFields)
        postBody = mp;
    }
    else {
      formParams.put("data", data);}
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      if(hasFields)
        postBody = mp;
    }
    else {
      }
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      hasFields = true;
      mp.field("publishData", publishData, MediaType.MULTIPART_FORM_DATA_TYPE);
      if(hasFields)
        postBody = mp;
    }
    else {
      formParams.put("publishData", publishData);}
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      hasFields = true;
      mp.field("undoData", undoData, MediaType.MULTIPART_FORM_DATA_TYPE);
      if(hasFields)
        postBody = mp;
    }
    else {
      formParams.put("undoData", undoData);}
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      hasFields = true;
      for(String id:ids) { mp.field("ids[]", id, MediaType.MULTIPART_FORM_DATA_TYPE); }
      if(hasFields)
        postBody = mp;
    }
    else {
      throw new java.lang.RuntimeException("invalid content type");}
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";

    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      if(hasFields)
        postBody = mp;
    }
    else {
      }
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

    String url = baseUrl.endsWith("/") ? (baseUrl + REPO_FILES_IMPORT) : (baseUrl + "/" + REPO_FILES_IMPORT);
   
    WebResource resource = client.resource(url);
    int responseCode = 504;
    try {
      FormDataMultiPart part = new FormDataMultiPart();
      part.field("importDir", repositoryPath, MediaType.MULTIPART_FORM_DATA_TYPE);
      part.field("fileUpload", fileInputStream, MediaType.MULTIPART_FORM_DATA_TYPE);
      part.field("overwriteFile", String.valueOf(overwriteIfExists), MediaType.MULTIPART_FORM_DATA_TYPE);
      part.field( "fileNameOverride", fileName, MediaType.MULTIPART_FORM_DATA_TYPE );
     
      part.getField("fileUpload").setContentDisposition(FormDataContentDisposition.name("fileUpload").fileName( fileName ).build());

      WebResource.Builder builder = resource.type(MediaType.MULTIPART_FORM_DATA);
      ClientResponse response =  builder.post(ClientResponse.class, part);

      if(response != null){
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

            // Export to a file so we can send it over the wire
            final File archiveFile = new File(new File(System.getProperty("java.io.tmpdir")), archiveName);
            archive.as(ZipExporter.class).exportZip(archiveFile, true);

            // Build up the POST form to send to Glassfish
            final FormDataMultiPart form = new FormDataMultiPart();
            form.getBodyParts().add(new FileDataBodyPart("id", archiveFile));
            form.field("contextroot", archiveName.substring(0, archiveName.lastIndexOf(".")), MediaType.TEXT_PLAIN_TYPE);
            deploymentName = archiveName.substring(0, archiveName.lastIndexOf("."));
            form.field("name", deploymentName, MediaType.TEXT_PLAIN_TYPE);
            final String xmlResponse = prepareClient(APPLICATION).type(MediaType.MULTIPART_FORM_DATA_TYPE)
                    .post(String.class, form);

            try {
                if (!isCallSuccessful(xmlResponse)) {
View Full Code Here

Examples of com.sun.jersey.multipart.FormDataMultiPart

   
    // create a WebResource to access the given url
    WebResource resource = Client.create().resource(url);
   
    // prepare form data for posting
    FormDataMultiPart form = new FormDataMultiPart();
   
    // set the output format to soap12
    // triggers the various outputs formats of the validator. If unset, the usual Web format will be sent.
    // If set to soap12,
    // the SOAP1.2 interface will be triggered. See the SOAP 1.2 response format description at
    //  http://validator.w3.org/docs/api.html#requestformat
    form.field("output", "soap12");
 
    // make sure Unicode 0x0 chars are removed from html (if any)
    // see https://github.com/WolfgangFahl/w3cValidator/issues/1
    Pattern pattern = Pattern.compile("[\\000]*");
    Matcher matcher = pattern.matcher(html);
    if (matcher.find()) {
       html = matcher.replaceAll("");
    }
   
    // The document to validate, POSTed as multipart/form-data
    FormDataBodyPart fdp = new FormDataBodyPart("uploaded_file",
        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

Examples of com.sun.jersey.multipart.FormDataMultiPart

            super(is);
        }

        @Override
        public Object[] getInjectableValues(HttpContext context) {
            FormDataMultiPart form = context.getRequest().getEntity(FormDataMultiPart.class);
            context.getProperties().put(FORM_MULTIPART_PROPERTY, form);

            return super.getInjectableValues(context);
        }
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.