/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param parser the line parser. * @param params HTTP parameters. */ public AbstractMessageParser( final SessionInputBuffer buffer, final LineParser parser, final HttpParams params) { super(); if (buffer == null) { throw new IllegalArgumentException("Session input buffer may not be null"); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.sessionBuffer = buffer; this.maxHeaderCount = params.getIntParameter( CoreConnectionPNames.MAX_HEADER_COUNT, -1); this.maxLineLen = params.getIntParameter( CoreConnectionPNames.MAX_LINE_LENGTH, -1); this.lineParser = (parser != null) ? parser : BasicLineParser.DEFAULT; this.headerLines = new ArrayList<CharArrayBuffer>(); this.state = HEAD_LINE; }
public DefaultResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException ("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); this.maxGarbageLines = getMaxGarbageLines(params); }
public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException ("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param parser the line parser. * @param responseFactory the factory to use to create * {@link HttpResponse}s. * @param params HTTP parameters. */ public HttpResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param parser the line parser. * @param responseFactory the factory to use to create * {@link HttpResponse}s. * @param params HTTP parameters. */ public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param parser the line parser. * @param requestFactory the factory to use to create * {@link HttpRequest}s. * @param params HTTP parameters. */ public DefaultHttpRequestParser( final SessionInputBuffer buffer, final LineParser parser, final HttpRequestFactory requestFactory, final HttpParams params) { super(buffer, parser, params); if (requestFactory == null) { throw new IllegalArgumentException("Request factory may not be null"); } this.requestFactory = requestFactory; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param parser the line parser. * @param requestFactory the factory to use to create * {@link HttpRequest}s. * @param params HTTP parameters. */ public HttpRequestParser( final SessionInputBuffer buffer, final LineParser parser, final HttpRequestFactory requestFactory, final HttpParams params) { super(buffer, parser, params); if (requestFactory == null) { throw new IllegalArgumentException("Request factory may not be null"); } this.requestFactory = requestFactory; this.lineBuf = new CharArrayBuffer(128); }
public DefaultHttpResponseParserFactory( final LineParser lineParser, final HttpResponseFactory responseFactory) { super(); this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE; this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactoryHC4.INSTANCE; }
/** * @deprecated (4.3) use {@link DefaultHttpResponseParser#DefaultHttpResponseParser( * SessionInputBuffer, LineParser, HttpResponseFactory, MessageConstraints)} */ @Deprecated public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); Args.notNull(responseFactory, "Response factory"); this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); }
public DefaultHttpResponseParserFactory(final LineParser lineParser, final HttpResponseFactory responseFactory) { super(); this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE; this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactoryHC4.INSTANCE; }
public DefaultHttpRequestParserFactory(final LineParser lineParser, final HttpRequestFactory requestFactory) { super(); this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE; this.requestFactory = requestFactory != null ? requestFactory : DefaultHttpRequestFactoryHC4.INSTANCE; }
/** * Creates an instance of AbstractMessageParserHC4. * * @param buffer the session input buffer. * @param parser the line parser. * @param params HTTP parameters. * * @deprecated (4.3) use {@link AbstractMessageParserHC4#AbstractMessageParserHC4(SessionInputBuffer, * LineParser, MessageConstraints)} */ @Deprecated public AbstractMessageParserHC4( final SessionInputBuffer buffer, final LineParser parser, final HttpParams params) { super(); Args.notNull(buffer, "Session input buffer"); Args.notNull(params, "HTTP parameters"); this.sessionBuffer = buffer; this.messageConstraints = HttpParamConfig.getMessageConstraints(params); this.lineParser = (parser != null) ? parser : BasicLineParserHC4.INSTANCE; this.headerLines = new ArrayList<CharArrayBuffer>(); this.state = HEAD_LINE; }
/** * Creates new instance of AbstractMessageParserHC4. * * @param buffer the session input buffer. * @param lineParser the line parser. If <code>null</code> {@link BasicLineParserHC4#INSTANCE} * will be used. * @param constraints the message constraints. If <code>null</code> * {@link MessageConstraints#DEFAULT} will be used. * * @since 4.3 */ public AbstractMessageParserHC4( final SessionInputBuffer buffer, final LineParser lineParser, final MessageConstraints constraints) { super(); this.sessionBuffer = Args.notNull(buffer, "Session input buffer"); this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE; this.messageConstraints = constraints != null ? constraints : MessageConstraints.DEFAULT; this.headerLines = new ArrayList<CharArrayBuffer>(); this.state = HEAD_LINE; }
public DefaultResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); Args.notNull(responseFactory, "Response factory"); this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); this.maxGarbageLines = getMaxGarbageLines(params); }
public DefaultHttpResponseParserFactory( final LineParser lineParser, final HttpResponseFactory responseFactory) { super(); this.lineParser = lineParser != null ? lineParser : BasicLineParser.INSTANCE; this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactory.INSTANCE; }
public DefaultResponseParser( final SessionInputBuffer buffer, final LineParser parser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, parser, params); if (responseFactory == null) { throw new IllegalArgumentException ("Response factory may not be null"); } this.responseFactory = responseFactory; this.lineBuf = new CharArrayBuffer(128); this.maxGarbageLines = params.getIntParameter( ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE); }
public GarbageAllergicHttpResponseParser(SessionInputBuffer buffer, LineParser lineParser, HttpResponseFactory responseFactory, MessageConstraints constraints) { super(buffer, lineParser, responseFactory, constraints); }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be <code>null</code>, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, int maxHeaderCount, int maxLineLen, LineParser parser) throws HttpException, IOException { if (parser == null) { parser = BasicLineParser.DEFAULT; } List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser, headerLines); }
/** * Creates new instance of DefaultHttpResponseParser. * * @param buffer the session input buffer. * @param lineParser the line parser. If <code>null</code> * {@link org.apache.http.message.BasicLineParserHC4#INSTANCE} will be used. * @param responseFactory HTTP response factory. If <code>null</code> * {@link DefaultHttpResponseFactoryHC4#INSTANCE} will be used. * @param constraints the message constraints. If <code>null</code> * {@link MessageConstraints#DEFAULT} will be used. * * @since 4.3 */ public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpResponseFactory responseFactory, final MessageConstraints constraints) { super(buffer, lineParser, constraints); this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactoryHC4.INSTANCE; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param lineParser the line parser. * @param responseFactory the factory to use to create * {@link HttpResponse}s. * @param params HTTP parameters. * * @deprecated (4.3) use * {@link DefaultHttpResponseParser#DefaultHttpResponseParser(SessionInputBuffer, LineParser, * HttpResponseFactory, MessageConstraints)} */ @Deprecated public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpResponseFactory responseFactory, final HttpParams params) { super(buffer, lineParser, params); this.responseFactory = Args.notNull(responseFactory, "Response factory"); this.lineBuf = new CharArrayBuffer(128); }
/** * Creates new instance of DefaultHttpResponseParser. * * @param buffer the session input buffer. * @param lineParser the line parser. If <code>null</code> * {@link org.apache.http.message.BasicLineParserHC4#INSTANCE} will be used * @param responseFactory the response factory. If <code>null</code> * {@link DefaultHttpResponseFactoryHC4#INSTANCE} will be used. * @param constraints the message constraints. If <code>null</code> * {@link MessageConstraints#DEFAULT} will be used. * * @since 4.3 */ public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpResponseFactory responseFactory, final MessageConstraints constraints) { super(buffer, lineParser, constraints); this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactoryHC4.INSTANCE; this.lineBuf = new CharArrayBuffer(128); }
/** * Creates an instance of this class. * * @param buffer the session input buffer. * @param lineParser the line parser. * @param requestFactory the factory to use to create * {@link HttpRequest}s. * @param params HTTP parameters. * * @deprecated (4.3) use * {@link DefaultHttpRequestParser#DefaultHttpRequestParser(SessionInputBuffer, LineParser, * HttpRequestFactory, MessageConstraints)} */ @Deprecated public DefaultHttpRequestParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpRequestFactory requestFactory, final HttpParams params) { super(buffer, lineParser, params); this.requestFactory = Args.notNull(requestFactory, "Request factory"); this.lineBuf = new CharArrayBuffer(128); }
/** * Creates new instance of DefaultHttpRequestParser. * * @param buffer the session input buffer. * @param lineParser the line parser. If <code>null</code> * {@link org.apache.http.message.BasicLineParserHC4#INSTANCE} will be used. * @param requestFactory the response factory. If <code>null</code> * {@link DefaultHttpRequestFactoryHC4#INSTANCE} will be used. * @param constraints the message constraints. If <code>null</code> * {@link MessageConstraints#DEFAULT} will be used. * * @since 4.3 */ public DefaultHttpRequestParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpRequestFactory requestFactory, final MessageConstraints constraints) { super(buffer, lineParser, constraints); this.requestFactory = requestFactory != null ? requestFactory : DefaultHttpRequestFactoryHC4.INSTANCE; this.lineBuf = new CharArrayBuffer(128); }
/** * Parses HTTP headers from the data receiver stream according to the generic * format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3. * * @param inbuffer Session input buffer * @param maxHeaderCount maximum number of headers allowed. If the number * of headers received from the data stream exceeds maxCount value, an * IOException will be thrown. Setting this parameter to a negative value * or zero will disable the check. * @param maxLineLen maximum number of characters for a header line, * including the continuation lines. Setting this parameter to a negative * value or zero will disable the check. * @return array of HTTP headers * @param parser line parser to use. Can be <code>null</code>, in which case * the default implementation of this interface will be used. * * @throws IOException in case of an I/O error * @throws HttpException in case of HTTP protocol violation */ public static Header[] parseHeaders( final SessionInputBuffer inbuffer, final int maxHeaderCount, final int maxLineLen, final LineParser parser) throws HttpException, IOException { final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>(); return parseHeaders(inbuffer, maxHeaderCount, maxLineLen, parser != null ? parser : BasicLineParserHC4.INSTANCE, headerLines); }
/** * Creates new instance of DefaultHttpResponseParser. * * @param buffer the session input buffer. * @param lineParser the line parser. If {@code null} * {@link org.apache.http.message.BasicLineParser#INSTANCE} will be used. * @param responseFactory HTTP response factory. If {@code null} * {@link DefaultHttpResponseFactory#INSTANCE} will be used. * @param constraints the message constraints. If {@code null} * {@link MessageConstraints#DEFAULT} will be used. * * @since 4.3 */ public DefaultHttpResponseParser( final SessionInputBuffer buffer, final LineParser lineParser, final HttpResponseFactory responseFactory, final MessageConstraints constraints) { super(buffer, lineParser, constraints); this.responseFactory = responseFactory != null ? responseFactory : DefaultHttpResponseFactory.INSTANCE; this.lineBuf = new CharArrayBuffer(128); }