Examples of ByteArrayPartSource


Examples of com.ning.http.multipart.ByteArrayPartSource

                        ((FilePart) part).getFile(),
                        ((FilePart) part).getMimeType(),
                        ((FilePart) part).getCharSet());

            } else if (part instanceof ByteArrayPart) {
                PartSource source = new ByteArrayPartSource(((ByteArrayPart) part).getFileName(), ((ByteArrayPart) part).getData());
                parts[i] = new com.ning.http.multipart.FilePart(part.getName(),
                        source,
                        ((ByteArrayPart) part).getMimeType(),
                        ((ByteArrayPart) part).getCharSet());
View Full Code Here

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

                                                                             userNameAndPassword[1]));
        }

        for (Map.Entry<String, byte[]> e : uploads.entrySet()) {
            method.addPart(new FilePart("filepath",
                           new ByteArrayPartSource(e.getKey(), e.getValue())));
        }
        client.executeMethod(method);
        return method;
    }
View Full Code Here

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

        httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("Admin", "admin"));
        httpClient.getParams().setAuthenticationPreemptive(true);

        Part[] parts = new Part[1];

        ByteArrayPartSource baps = new ByteArrayPartSource(attachmentName, content.getBytes());
        parts[0] = new FilePart(attachmentName, baps);

        PostMethod postMethod = new PostMethod(attachmentsUri);
        MultipartRequestEntity mpre = new MultipartRequestEntity(parts, postMethod.getParams());
        postMethod.setRequestEntity(mpre);
View Full Code Here

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

            List<Part> partList = new ArrayList<Part>();
            partList.add(new StringPart("action", "install"));
            partList.add(new StringPart("_noredir_", "_noredir_"));
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            IOUtils.copy(in, baos);
            PartSource partSource = new ByteArrayPartSource(fileName, baos.toByteArray());
            partList.add(new FilePart("bundlefile", partSource));
            partList.add(new StringPart("bundlestart", "start"));

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

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

        new LocalBundleInstaller(getHttpClient(), repositoryInfo) {

            @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

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

    this.signInResult = signInResult;
    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.ByteArrayPartSource

 
  public static RegistrationResult register(String username, String password,
      String ontologyUri, String fileName, String fileContents, String graphId
  ) throws HttpException, IOException {
   
    PartSource partSource = new ByteArrayPartSource(fileName, fileContents.getBytes());
   
    System.out.println("Executing POST request to " +FORM_ACTION);
    PostMethod post = new PostMethod(FORM_ACTION);
    post.addRequestHeader("accept", "text/plain");
    try {
View Full Code Here

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

        MultipartPostMethod method = new MultipartPostMethod(bodyPath);
        byte[] content = "Hello".getBytes();
        method.addPart(
          new FilePart(
            "param1",
            new ByteArrayPartSource("filename.txt", content),
            "text/plain",
            "ISO-8859-1"));

        httpClient.executeMethod(method);
View Full Code Here

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

        PostMethod post = new PostMethod("http://localhost:" + PORT + "/bookstore/books/image");
        String ct = "multipart/mixed";
        post.setRequestHeader("Content-Type", ct);
        Part[] parts = new Part[1];
        parts[0] = new FilePart("image",
                new ByteArrayPartSource("testfile.png", new byte[1024 * 11]),
                "image/png", null);
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));

        HttpClient httpclient = new HttpClient();

View Full Code Here

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

        PostMethod post = new PostMethod("http://localhost:" + PORT + "/bookstore/books/image");
        String ct = "multipart/mixed";
        post.setRequestHeader("Content-Type", ct);
        Part[] parts = new Part[2];
        parts[0] = new FilePart("image",
                new ByteArrayPartSource("testfile.png", new byte[1024 * 9]),
                "image/png", null);
        parts[1] = new FilePart("image",
                new ByteArrayPartSource("testfile2.png", new byte[1024 * 11]),
                "image/png", null);
        post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));

        HttpClient httpclient = new HttpClient();

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.