Example usage for org.apache.http.message LineParser parseStatusLine

List of usage examples for org.apache.http.message LineParser parseStatusLine

Introduction

In this page you can find the example usage for org.apache.http.message LineParser parseStatusLine.

Prototype

StatusLine parseStatusLine(CharArrayBuffer charArrayBuffer, ParserCursor parserCursor) throws ParseException;

Source Link

Usage

From source file:com.subgraph.vega.ui.httpeditor.parser.HttpResponseParser.java

/**
 * Read and parse the response line./* w  w  w. jav  a  2 s.com*/
 * 
 * @param parser HC LineParser.
 * @param builder HTTP response builder.
 * @param buf
 * @param bufCursor
 * @return
 */
private int parseStatusLine(final LineParser parser, final IHttpResponseBuilder builder,
        final CharArrayBuffer buf, final ParserCursor bufCursor) {
    final CharArrayBuffer lnBuf = new CharArrayBuffer(0);
    if (readLine(buf, bufCursor, lnBuf) < 1) {
        // no data!
        return -1;
    }
    final ParserCursor lnCursor = new ParserCursor(0, lnBuf.length());

    final StatusLine statusLine = parser.parseStatusLine(lnBuf, lnCursor);
    builder.setFromStatusLine(statusLine);

    return 0;
}