public void setStatusLine(final ProtocolVersion ver, final int code) { // arguments checked in BasicStatusLine constructor this.statusline = new BasicStatusLine(ver, code, getReason(code)); }
@Override public void addHeader(String key, String value) { request.addHeader(new BasicHeader(key, value)); }
/** * Returns an iterator over this group of headers. * * @return iterator over this group of headers. * * @since 4.0 */ public HeaderIterator iterator() { return new BasicListHeaderIterator(this.headers, null); }
/** * Creates a name-value pair. * Called from {@link #parseNameValuePair}. * * @param name the name * @param value the value, or <code>null</code> * * @return a name-value pair representing the arguments */ protected NameValuePair createNameValuePair(final String name, final String value) { return new BasicNameValuePair(name, value); }
public void setHeader(final String name, final String value) { if (name == null) { throw new IllegalArgumentException("Header name may not be null"); } this.headergroup.updateHeader(new BasicHeader(name, value)); }
public void addHeader(final String name, final String value) { if (name == null) { throw new IllegalArgumentException("Header name may not be null"); } this.headergroup.addHeader(new BasicHeader(name, value)); }
private static BasicHttpResponse createResponse(int statusCode) { return new BasicHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, statusCode, null)); }
public void setStatusLine(final ProtocolVersion ver, final int code, final String reason) { // arguments checked in BasicStatusLine constructor this.statusline = new BasicStatusLine(ver, code, reason); }
public HeaderElement[] getElements() throws ParseException { ParserCursor cursor = new ParserCursor(0, this.buffer.length()); cursor.updatePos(this.valuePos); return BasicHeaderValueParser.DEFAULT .parseElements(this.buffer, cursor); }
public Header parseHeader(CharArrayBuffer buffer) throws ParseException { // the actual parser code is in the constructor of BufferedHeader return new BufferedHeader(buffer); }
public RequestLine getRequestLine() { if (this.requestline != null) { return this.requestline; } else { ProtocolVersion ver = HttpProtocolParams.getVersion(getParams()); return new BasicRequestLine(this.method, this.uri, ver); } }
/** * Creates a header element. * Called from {@link #parseHeaderElement}. * * @return a header element representing the argument */ protected HeaderElement createHeaderElement( final String name, final String value, final NameValuePair[] params) { return new BasicHeaderElement(name, value, params); }
protected AbstractHttpMessage(final HttpParams params) { super(); this.headergroup = new HeaderGroup(); this.params = params; }
/** * Returns the next header. * Same as {@link #nextHeader nextHeader}, but not type-safe. * * @return the next header in this iteration * * @throws NoSuchElementException if there are no more headers */ public final Object next() throws NoSuchElementException { return nextHeader(); }
public boolean hasNext() { if (this.currentElement == null) { parseNextElement(); } return this.currentElement != null; }
/** * Returns the next header. * Same as {@link #nextHeader nextHeader}, but not type-safe. * * @return the next header in this iteration * * @throws NoSuchElementException if there are no more headers */ public final Object next() throws NoSuchElementException { return nextHeader(); }
@Override public void addHeader(String key, String value) { request.addHeader(new BasicHeader(key, value)); }
Header[] headers = { new BasicHeader("Content-type", "application/x-www-form-urlencoded") ,new BasicHeader("Content-type", "application/x-www-form-urlencoded") ,new BasicHeader("Accep", "text/html,text/xml,application/xml") ,new BasicHeader("Connection", "keep-alive") ,new BasicHeader("keep-alive", "115") ,new BasicHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2") };
@Override @Nullable public Header getContentEncoding() { String contentEncoding = this.headers.getFirst("Content-Encoding"); return (contentEncoding != null ? new BasicHeader("Content-Encoding", contentEncoding) : null); }
@Override @Nullable public Header getContentType() { MediaType contentType = this.headers.getContentType(); return (contentType != null ? new BasicHeader("Content-Type", contentType.toString()) : null); }