Example usage for org.apache.commons.httpclient HttpConnection writeLine

List of usage examples for org.apache.commons.httpclient HttpConnection writeLine

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpConnection writeLine.

Prototype

public void writeLine() throws IOException, IllegalStateException 

Source Link

Document

Writes "\r\n".getBytes() to the output stream.

Usage

From source file:com.gs.jrpip.client.StreamedPostMethod.java

public void reallyWriteHeaders(HttpState state, HttpConnection conn) throws IOException {
    this.writeRequestLine(state, conn);
    this.writeRequestHeaders(state, conn);
    conn.writeLine(); // close head
    // make sure the status line and headers have been sent
    conn.flushRequestOutputStream();/*from  w  ww . j a v  a  2s .c o  m*/
}

From source file:com.gs.jrpip.client.BufferedPostMethod.java

@Override
protected void writeRequest(HttpState state, HttpConnection conn) throws IOException {
    try {// w w  w . java 2  s  .c  o m
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream(2048);
        this.writer.write(outputStream);
        outputStream.close();
        this.result = outputStream.toByteArray();
        this.setRequestEntity(this);

        this.writeRequestLine(state, conn);
        this.writeRequestHeaders(state, conn);
        conn.writeLine(); // close head
        // make sure the status line and headers have been sent
        conn.flushRequestOutputStream();
        this.writeRequestBody(state, conn);
        conn.flushRequestOutputStream();
    } catch (IOException e) {
        this.cleanupConnection(conn);
        throw e;
    }
}