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

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

Introduction

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

Prototype

@Override
public StatusLine getStatusLine() 

Source Link

Document

Provides access to the response status line.

Usage

From source file:org.apache.commons.httpclient.demo.HttpMultiPartFileUpload.java

public static void main(String[] args) throws IOException {
    HttpClient client = new HttpClient();
    MultipartPostMethod mPost = new MultipartPostMethod(url);
    client.setConnectionTimeout(8000);//from w  w  w  .j av a  2  s.  c om

    // Send any XML file as the body of the POST request
    File f1 = new File("students.xml");
    File f2 = new File("academy.xml");
    File f3 = new File("academyRules.xml");

    System.out.println("File1 Length = " + f1.length());
    System.out.println("File2 Length = " + f2.length());
    System.out.println("File3 Length = " + f3.length());

    mPost.addParameter(f1.getName(), f1);
    mPost.addParameter(f2.getName(), f2);
    mPost.addParameter(f3.getName(), f3);

    //int statusCode1 = client.executeMethod(mPost);

    System.out.println("statusLine>>>" + mPost.getStatusLine());

    //
    String response = new String(mPost.getResponseBodyAsString().getBytes("8859_1"));
    //
    System.out.println("===================================");
    System.out.println(":");
    System.out.println(response);
    System.out.println("===================================");

    mPost.releaseConnection();
}