Example usage for org.apache.commons.httpclient.methods FileRequestEntity FileRequestEntity

List of usage examples for org.apache.commons.httpclient.methods FileRequestEntity FileRequestEntity

Introduction

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

Prototype

public FileRequestEntity(final File file, final String contentType) 

Source Link

Usage

From source file:uk.ac.ebi.arrayexpress.servlets.GenomeSpaceUploadServlet.java

private Integer putFile(UploadFileInfo fileInfo) throws IOException {
    PutMethod put = new PutMethod(fileInfo.getUploadURL());
    RequestEntity entity = new FileRequestEntity(fileInfo.getFile(), fileInfo.GetContentType());
    put.setRequestEntity(entity);//from  www .  j  av  a2  s. com
    put.setRequestHeader("Content-MD5", fileInfo.getContentMD5());

    Integer statusCode = null;
    try {
        statusCode = httpClient.executeMethod(put);
    } catch (HttpException x) {
        logger.error("Caught an exception:", x);
    } finally {
        put.releaseConnection();
    }
    return statusCode;
}