Examples of FilePart


Examples of org.apache.commons.httpclient.methods.multipart.FilePart

    /** Upload to an file node structure, see SLING-168 */
    public void uploadToFileNode(String url, File localFile, String fieldName, String typeHint)
        throws IOException {

        final Part[] parts = new Part[typeHint == null ? 1 : 2];
        parts[0] = new FilePart(fieldName, localFile);
        if (typeHint != null) {
            parts[1] = new StringPart(fieldName + "@TypeHint", typeHint);
        }
        final PostMethod post = new PostMethod(url);
        post.setFollowRedirects(false);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

    public void uploadToFileNodes(String url, File[] localFiles, String[] fieldNames, String[] typeHints)
        throws IOException {

      List<Part> partsList = new ArrayList<Part>();
      for (int i=0; i < localFiles.length; i++) {
            Part filePart = new FilePart(fieldNames[i], localFiles[i]);
            partsList.add(filePart);
            if (typeHints != null) {
              Part typeHintPart = new StringPart(fieldNames[i] + "@TypeHint", typeHints[i]);
              partsList.add(typeHintPart);
            }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

        // with session id
        parts = new Part[3];
        parts[0] = new StringPartNoTransferEncoding("sid", sid);
        parts[1] = new StringPartNoTransferEncoding(
            "ImportExportPassword", "");
        parts[2] = new FilePart("ConfigImportFile",
            uploadFile.getName(), uploadFile);
      } else {
        // old style, no session id
        parts = new Part[2];
        parts[0] = new StringPartNoTransferEncoding(
            "ImportExportPassword", "");
        parts[1] = new FilePart("ConfigImportFile",
            uploadFile.getName(), uploadFile);
      }

      mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost
          .getParams()));
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

                    public InputStream createInputStream() throws IOException {
                      return c.getStream();
                    }
                  };
               
                  parts.add(new FilePart(c.getName(), source,
                                         c.getContentType(), charSet));
                }
              }
              if (parts.size() > 0) {
                post.setRequestEntity(new MultipartRequestEntity(parts
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

    this.ontologyId = ontologyId;
    this.ontologyUserId = ontologyUserId;
    this.values = values;
   
    PartSource partSource = new ByteArrayPartSource(fileName, RDF.getBytes(CHARSET_UTF8));
    filePart = new FilePart("filePath", partSource);
    filePart.setCharSet(CHARSET_UTF8);
  }
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

    try {
      Part[] parts = new Part[] {
          new StringPart("username", username),
          new StringPart("password", password),
          new StringPart("ontologyUri", ontologyUri),
          new FilePart("ontologyFile", partSource),
          new StringPart("graphId", graphId),
      };
      post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
      HttpClient client = new HttpClient();
      client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

            params.add(new StringPart("city", addressArr[2]));
            params.add(new StringPart("state", addressArr[3]));
            params.add(new StringPart("zip", addressArr[4]));
            params.add(new StringPart("country", addressArr[5]));

            params.add(new FilePart("upload_event_image", eventImg));
            params.add(new FilePart("upload_event_literature",eventPdf));
            params.add(new StringPart("submit", "Create"));
            /****
            Part[] parts = new Part[params.size()];
            parts = params.toArray(parts);

View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

        params.add(new StringPart("street2", addressArr[1]));
        params.add(new StringPart("city", addressArr[2]));
        params.add(new StringPart("state", addressArr[3]));
        params.add(new StringPart("zip", addressArr[4]));
        params.add(new StringPart("country", addressArr[5]));
        params.add(new FilePart("upload_person_image", personImg));
        /****
        Part[] parts = new Part[params.size()];
        parts = params.toArray(parts);

        PostMethod post = new PostMethod(fileUploadPersonURL+"?user_name="+parameters[0]);
View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

      dout.flush();
      InputStream inp = new ByteArrayInputStream(bout.toByteArray());
      //(inp.available() + " PAROT2 " + dv);
      StreamPartSource sps = new StreamPartSource ("directValues",inp,inp.available());
Part[] parts = new Part[1];
parts[0] = new FilePart("defaultValues",sps);
/*NameValuePair[] nvp =  method.getParameters();
for (int ct = 0;ct < nvp.length;ct++){
//(nvp[ct].getName() + " nvp[ct].getName(), nvp[ct].getValue() " + nvp[ct].getValue());
InputStream binp = new ByteArrayInputStream(nvp[ct].getValue().getBytes());

View Full Code Here

Examples of org.apache.commons.httpclient.methods.multipart.FilePart

            }
        }
        int index = 0;
        try {
            for(String fileKey : fileParameters.keySet()){
                FilePart filePart = new FilePart(fileKey, fileParameters.get(fileKey));  
                params[ (null == parameters ? 0 : parameters.size()) + index++ ] = filePart;  
            }
        } catch (Exception e) {
            throw new ReviewboardException(e);
        }
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.