public LengthDelimitedDecoder( final ReadableByteChannel channel, final SessionInputBuffer buffer, final HttpTransportMetricsImpl metrics, final long contentLength) { super(channel, buffer, metrics); Args.notNegative(contentLength, "Content length"); this.contentLength = contentLength; }
@Override public void setStatusCode(final int code) { Args.notNegative(code, "Status code"); this.statusline = null; this.code = code; this.reasonPhrase = null; }
/** * Creates an instance of {@link ByteArrayBuffer} with the given initial * capacity. * * @param capacity the capacity */ public ByteArrayBuffer(final int capacity) { super(); Args.notNegative(capacity, "Buffer capacity"); this.buffer = new byte[capacity]; }
@Override public void setStatusLine(final ProtocolVersion ver, final int code) { Args.notNegative(code, "Status code"); this.statusline = null; this.ver = ver; this.code = code; this.reasonPhrase = null; }
/** * Creates an instance of {@link CharArrayBuffer} with the given initial * capacity. * * @param capacity the capacity */ public CharArrayBuffer(final int capacity) { super(); Args.notNegative(capacity, "Buffer capacity"); this.buffer = new char[capacity]; }
@Override public void setStatusLine( final ProtocolVersion ver, final int code, final String reason) { Args.notNegative(code, "Status code"); this.statusline = null; this.ver = ver; this.code = code; this.reasonPhrase = reason; }
/** * Creates an instance of {@link CharArrayBuffer} with the given initial * capacity. * * @param capacity the capacity */ public CharArrayBuffer(final int capacity) { super(); Args.notNegative(capacity, "Buffer capacity"); this.buffer = new char[capacity]; }
/** * Creates an instance of {@link ByteArrayBuffer} with the given initial * capacity. * * @param capacity the capacity */ public ByteArrayBuffer(final int capacity) { super(); Args.notNegative(capacity, "Buffer capacity"); this.buffer = new byte[capacity]; }
/** * Creates an instance of {@link ByteArrayBuffer} with the given initial * capacity. * * @param capacity the capacity */ public ByteArrayBuffer(final int capacity) { super(); Args.notNegative(capacity, "Buffer capacity"); this.buffer = new byte[capacity]; }
/** * Create a protocol version designator. * * @param protocol the name of the protocol, for example "HTTP" * @param major the major version number of the protocol * @param minor the minor version number of the protocol */ public ProtocolVersion(final String protocol, final int major, final int minor) { this.protocol = Args.notNull(protocol, "Protocol name"); this.major = Args.notNegative(major, "Protocol minor version"); this.minor = Args.notNegative(minor, "Protocol minor version"); }
/** * Create a protocol version designator. * * @param protocol the name of the protocol, for example "HTTP" * @param major the major version number of the protocol * @param minor the minor version number of the protocol */ public ProtocolVersion(final String protocol, final int major, final int minor) { this.protocol = Args.notNull(protocol, "Protocol name"); this.major = Args.notNegative(major, "Protocol minor version"); this.minor = Args.notNegative(minor, "Protocol minor version"); }
public void setDefaultMaxPerRoute(final int max) { Args.notNegative(max, "Max per route value"); this.lock.lock(); try { this.defaultMaxPerRoute = max; } finally { this.lock.unlock(); } }
/** * Create a protocol version designator. * * @param protocol the name of the protocol, for example "HTTP" * @param major the major version number of the protocol * @param minor the minor version number of the protocol */ public ProtocolVersion(final String protocol, final int major, final int minor) { this.protocol = Args.notNull(protocol, "Protocol name"); this.major = Args.notNegative(major, "Protocol minor version"); this.minor = Args.notNegative(minor, "Protocol minor version"); }
public void setDefaultMaxPerRoute(final int max) { Args.notNegative(max, "Max per route value"); this.lock.lock(); try { this.defaultMaxPerRoute = max; } finally { this.lock.unlock(); } }
public void setMaxTotal(final int max) { Args.notNegative(max, "Max value"); this.lock.lock(); try { this.maxTotal = max; } finally { this.lock.unlock(); } }
@Override public final HttpHost getHopTarget(final int hop) { Args.notNegative(hop, "Hop index"); final int hopcount = getHopCount(); Args.check(hop < hopcount, "Hop index exceeds tracked route length"); if (hop < hopcount - 1) { return this.proxyChain.get(hop); } else { return this.targetHost; } }
public final HttpHost getHopTarget(final int hop) { Args.notNegative(hop, "Hop index"); final int hopcount = getHopCount(); Args.check(hop < hopcount, "Hop index exceeds tracked route length"); if (hop < hopcount - 1) { return this.proxyChain.get(hop); } else { return this.targetHost; } }
@Override public final HttpHost getHopTarget(final int hop) { Args.notNegative(hop, "Hop index"); final int hopcount = getHopCount(); Args.check(hop < hopcount, "Hop index exceeds tracked route length"); if (hop < hopcount - 1) { return this.proxyChain.get(hop); } else { return this.targetHost; } }
@Override public final HttpHost getHopTarget(final int hop) { Args.notNegative(hop, "Hop index"); final int hopcount = getHopCount(); Args.check(hop < hopcount, "Hop index exceeds tracked route length"); if (hop < hopcount - 1) { return this.proxyChain.get(hop); } else { return this.targetHost; } }
public final HttpHost getHopTarget(final int hop) { Args.notNegative(hop, "Hop index"); final int hopcount = getHopCount(); Args.check(hop < hopcount, "Hop index exceeds tracked route length"); HttpHost result = null; if (hop < hopcount-1) { result = this.proxyChain[hop]; } else { result = this.targetHost; } return result; }