Package org.apache.commons.httpclient.methods.multipart

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


    @Override
    public Result<Void> execute() {
        PostMethod post = new PostMethod(getPath());
      try{
        Part[] parts ={new StringPart(":operation", "delete")};
        post.setRequestEntity(new MultipartRequestEntity(parts,post.getParams()));
        httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(repositoryInfo.getUsername(),repositoryInfo.getPassword()));
        httpClient.getParams().setAuthenticationPreemptive(true);
        int responseStatus=httpClient.executeMethod(post);
       
        return resultForResponseStatus(responseStatus);
View Full Code Here


            partList.add(new FilePart("bundlefile", partSource));
            partList.add(new StringPart("bundlestart", "start"));

            Part[] parts = partList.toArray(new Part[partList.size()]);

            filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));

            int status = getHttpClient().executeMethod(filePost);
            if (status != 200) {
                throw new OsgiClientException("Method execution returned status " + status);
            }
View Full Code Here

            @Override
            void configureRequest(PostMethod method) throws IOException {

                Part[] parts = new Part[] { new FilePart("bundle", new ByteArrayPartSource("bundle.jar",
                        IOUtils.toByteArray(jarredBundle))) };
                method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams()));
            }
        }.installBundle();       
    }
View Full Code Here

                partList.add(new StringPart("refreshPackages", "true"));
            }

            Part[] parts = partList.toArray(new Part[partList.size()]);

            filePost.setRequestEntity(new MultipartRequestEntity(parts,
                filePost.getParams()));

            int status = getHttpClient().executeMethod(filePost);
            if (status == HttpStatus.SC_OK) {
                getLog().info("Bundle installed");
View Full Code Here

        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);
            int status = client.executeMethod(filePost);
View Full Code Here

                    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 {
              post.getParams().setContentCharset("UTF-8");
                for(NameValuePair e : nodeProperties) {
                    post.addParameter(e.getName(),e.getValue());
                }
View Full Code Here

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

        final int status = httpClient.executeMethod(post);
        final int expected = 200;
        if(status!=expected) {
            throw new HttpStatusCodeException(expected, status, "POST", HttpTestBase.getResponseBodyAsStream(post, 0));
View Full Code Here

    }

        final Part[] parts = partsList.toArray(new Part[partsList.size()]);
        final PostMethod post = new PostMethod(url);
        post.setFollowRedirects(false);
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));

        final int expected = 200;
        final int status = httpClient.executeMethod(post);
        if(status!=expected) {
            throw new HttpStatusCodeException(expected, status, "POST", HttpTestBase.getResponseBodyAsStream(post, 0));
View Full Code Here

        parts[0] = new StringPartNoTransferEncoding(
            "ImportExportPassword", "");
        parts[1] = new StringPartNoTransferEncoding("ConfigExport", "");
      }

      mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost
          .getParams()));

      statusCode = client.executeMethod(mPost);
      BufferedInputStream bis = new BufferedInputStream(
          mPost.getResponseBodyAsStream());
View Full Code Here

            "ImportExportPassword", "");
        parts[1] = new FilePart("ConfigImportFile",
            uploadFile.getName(), uploadFile);
      }

      mPost.setRequestEntity(new MultipartRequestEntity(parts, mPost
          .getParams()));

      HttpClient client = new HttpClient();
      client.getHttpConnectionManager().getParams()
          .setConnectionTimeout(8000);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity

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.