Examples of StringPart


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

       
        PostMethod filePost = new PostMethod(targetURL);
        try {
            Part[] parts = {
                new FilePart(file.getName(), new FilePartSource(file.getName(),
                    file)), new StringPart("_noredir_", "_noredir_") };
            filePost.setRequestEntity(new MultipartRequestEntity(parts,
                filePost.getParams()));
            HttpClient client = new HttpClient();
            client.getHttpConnectionManager().getParams().setConnectionTimeout(
                5000);
View Full Code Here

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

        if( nodeProperties.size() > 0) {
            if(multiPart) {
                final List<Part> partList = new ArrayList<Part>();
                for(NameValuePair e : nodeProperties) {
                    if (e.getValue() != null) {
                        partList.add(new StringPart(e.getName(), e.getValue(), "UTF-8"));
                    }
                }
                if  (localFile != null) {
                    partList.add(new FilePart(fieldName, localFile));
                    if (typeHint != null) {
                      partList.add(new StringPart(fieldName + "@TypeHint", typeHint));
                    }
                }
                final Part [] parts = partList.toArray(new Part[partList.size()]);
                post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
            } else {
View Full Code Here

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

        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);
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
View Full Code Here

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

      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);
            }
    }

        final Part[] parts = partsList.toArray(new Part[partsList.size()]);
View Full Code Here

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

                String p = iter.next();
                String[] vals = params.getParams(p);
                if (vals != null) {
                  for (String v : vals) {
                    if (this.useMultiPartPost || isMultipart) {
                      parts.add(new StringPart(p, v, "UTF-8"));
                    } else {
                      post.addParameter(p, v);
                    }
                  }
                }
View Full Code Here

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

      method = new PostMethod(buildBase + "/api/dependencies");
        try {
              String url = new URL(new URL(requestURL), "/maqetta/user/" + userID + "/ws/workspace/" + files[i].getPath()).toExternalForm();
              theLogger.finest("DWB: Analyse url="+url);
              Part[] parts = {
                new StringPart("value", url, "utf-8"),
                new StringPart("type", "URL")
              };
              method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams()));
              int statusCode = client.executeMethod(method);
              String body = method.getResponseBodyAsString();
              if (statusCode != HttpStatus.SC_OK) {
View Full Code Here

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

    PostMethod post = new PostMethod(ontologiesRestUrl);
    try {
      List<Part> partList = new ArrayList<Part>();
     
      partList.add(filePart);
      partList.add(new StringPart("sessionid", sessionId));
     
     
      // aquaportal version handling:
      if ontologyId != null ) {
        // put the ontologyId as reference for the creation of the new version
        partList.add(new StringPart("ontologyId", ontologyId));
      }
       
      String userId = _getUserId();
      partList.add(new StringPart("userId", userId));
     
      partList.add(new StringPart("urn", uri));
     
      String displayLabel = _getDisplayLabel();
      partList.add(new StringPart("displayLabel", displayLabel));
     
      String dateReleased = _getDateReleased();
      partList.add(new StringPart("dateReleased", dateReleased));

      String contactName = _getContactName();
      partList.add(new StringPart("contactName", contactName));

      String contactEmail = _getContactEmail();
      partList.add(new StringPart("contactEmail", contactEmail));

      String versionNumber = _getVersionNumber();
      partList.add(new StringPart("versionNumber", versionNumber));
     
      // FIXME: the following are hard-coded for now as they are NOT used by us (ORR)
      partList.add(new StringPart("format", "OWL-DL"));
      partList.add(new StringPart("isRemote", "0"));
      partList.add(new StringPart("statusId", "1"));
      partList.add(new StringPart("isReviewed", "1"));
      partList.add(new StringPart("codingScheme", "1"));
      partList.add(new StringPart("isManual", "1"));
      partList.add(new StringPart("isFoundry", "0"));

      // TODO: handle "categories" ?  For now, putting an arbitrary value
      // from the existing values in the default aquaportal database
      partList.add(new StringPart("categoryId", "2809"));

     
      // now, perform the POST:
      Part[] parts = partList.toArray(new Part[partList.size()]);
      post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
View Full Code Here

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

   
    PostMethod post = new PostMethod(action);
    try {
      List<Part> partList = new ArrayList<Part>();
     
      partList.add(new StringPart("sessionid", sessionId));
      partList.add(new StringPart("id", id));

      partList.add(new StringPart("method", "DELETE"));
      return _performPost(post, partList);
    }
    finally {
      post.releaseConnection();
    }
View Full Code Here

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

    }
   
    for (Entry<String, String> entry : vars.entrySet()) {
      String key = entry.getKey();
      String val = entry.getValue();
      partList.add(new StringPart(key, val));
    }
   
    // now, perform the POST:
    Part[] parts = partList.toArray(new Part[partList.size()]);
    meth.setRequestEntity(new MultipartRequestEntity(parts, meth.getParams()));
View Full Code Here

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

    System.out.println("Executing POST request to " +FORM_ACTION);
    PostMethod post = new PostMethod(FORM_ACTION);
    post.addRequestHeader("accept", "text/plain");
    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
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.