Example usage for org.apache.commons.httpclient.methods MultipartPostMethod addPart

List of usage examples for org.apache.commons.httpclient.methods MultipartPostMethod addPart

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods MultipartPostMethod addPart.

Prototype

public void addPart(Part paramPart) 

Source Link

Usage

From source file:org.openmicroscopy.is.HttpImageServer.java

public void setStack(long pixelsID, int theC, int theT, byte[] buf, boolean bigEndian)
        throws ImageServerException {
    MultipartPostMethod post = startCall();
    try {// ww w.j  a  va2  s  .  co  m
        post.addParameter("Method", "SetStack");
        post.addParameter("PixelsID", Long.toString(pixelsID));
        post.addParameter("theC", Integer.toString(theC));
        post.addParameter("theT", Integer.toString(theT));
        post.addParameter("UploadSize", Long.toString(buf.length));
        post.addParameter("BigEndian", bigEndian ? "1" : "0");
        post.addPart(new FilePart("Pixels", new ByteArrayPartSource("pixels", buf)));
        executeCall(post);

        return;
    } finally {
        finishCall(post);
    }
}

From source file:org.openmicroscopy.is.HttpImageServer.java

public void setPlane(long pixelsID, int theZ, int theC, int theT, byte[] buf, boolean bigEndian)
        throws ImageServerException {
    MultipartPostMethod post = startCall();
    try {//  w ww .j  a va2  s .  co  m
        post.addParameter("Method", "SetPlane");
        post.addParameter("PixelsID", Long.toString(pixelsID));
        post.addParameter("theZ", Integer.toString(theZ));
        post.addParameter("theC", Integer.toString(theC));
        post.addParameter("theT", Integer.toString(theT));
        post.addParameter("UploadSize", Long.toString(buf.length));
        post.addParameter("BigEndian", bigEndian ? "1" : "0");
        post.addPart(new FilePart("Pixels", new ByteArrayPartSource("pixels", buf)));
        executeCall(post);

        return;
    } finally {
        finishCall(post);
    }
}

From source file:org.openmicroscopy.is.HttpImageServer.java

public void setROI(long pixelsID, int x0, int y0, int z0, int c0, int t0, int x1, int y1, int z1, int c1,
        int t1, byte[] buf, boolean bigEndian) throws ImageServerException {
    String roi = x0 + "," + y0 + "," + z0 + "," + c0 + "," + t0 + "," + x1 + "," + y1 + "," + z1 + "," + c1
            + "," + t1;

    MultipartPostMethod post = startCall();
    try {//from w w  w  .  java  2 s .  co  m
        post.addParameter("Method", "SetROI");
        post.addParameter("PixelsID", Long.toString(pixelsID));
        post.addParameter("ROI", roi);
        post.addParameter("UploadSize", Long.toString(buf.length));
        post.addParameter("BigEndian", bigEndian ? "1" : "0");
        post.addPart(new FilePart("Pixels", new ByteArrayPartSource("pixels", buf)));
        executeCall(post);

        return;
    } finally {
        finishCall(post);
    }
}