Package org.apache.http.config

Examples of org.apache.http.config.MessageConstraints$Builder


    @Deprecated
    protected NHttpMessageParser<HttpRequest> createRequestParser(
            final SessionInputBuffer buffer,
            final HttpRequestFactory requestFactory,
            final HttpParams params) {
        final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
        return new DefaultHttpRequestParser(buffer, null, requestFactory, constraints);
    }
View Full Code Here


    protected NHttpMessageParser<HttpResponse> createResponseParser(
            final SessionInputBuffer buffer,
            final HttpResponseFactory responseFactory,
            final HttpParams params) {
        // override in derived class to specify a line parser
        final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
        return new DefaultHttpResponseParser(buffer, null, responseFactory, constraints);
    }
View Full Code Here

        connManager.setSocketConfig(new HttpHost("somehost", 80), socketConfig);
        // Validate connections after 1 sec of inactivity
        connManager.setValidateAfterInactivity(1000);

        // Create message constraints
        MessageConstraints messageConstraints = MessageConstraints.custom()
            .setMaxHeaderCount(200)
            .setMaxLineLength(2000)
            .build();
        // Create connection configuration
        ConnectionConfig connectionConfig = ConnectionConfig.custom()
View Full Code Here

        connManager.setSocketConfig(new HttpHost("somehost", 80), socketConfig);
        // Validate connections after 1 sec of inactivity
        connManager.setValidateAfterInactivity(1000);

        // Create message constraints
        MessageConstraints messageConstraints = MessageConstraints.custom()
            .setMaxHeaderCount(200)
            .setMaxLineLength(2000)
            .build();
        // Create connection configuration
        ConnectionConfig connectionConfig = ConnectionConfig.custom()
View Full Code Here

    @Deprecated
    protected NHttpMessageParser<HttpRequest> createRequestParser(
            final SessionInputBuffer buffer,
            final HttpRequestFactory requestFactory,
            final HttpParams params) {
        final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
        return new DefaultHttpRequestParser(buffer, null, requestFactory, constraints);
    }
View Full Code Here

    @Test
    public void testLineLimitForFoldedHeader() throws Exception {
        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);

        final MessageConstraints constraints = MessageConstraints.custom()
                .setMaxHeaderCount(2).setMaxLineLength(15).build();
        final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, constraints);
        try {
            requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n" +
                    " 23456789012345\r\n 23456789012345\r\n 23456789012345\r\n\r\n"));
View Full Code Here

    @Test
    public void testMaxHeaderCount() throws Exception {
        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);

        final MessageConstraints constraints = MessageConstraints.custom()
                .setMaxHeaderCount(2).setMaxLineLength(-1).build();
        final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, constraints);
        requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\nHeader: two\r\n\r\n"));
        requestParser.parse();
        requestParser.reset();
View Full Code Here

    protected NHttpMessageParser<HttpResponse> createResponseParser(
            final SessionInputBuffer buffer,
            final HttpResponseFactory responseFactory,
            final HttpParams params) {
        // override in derived class to specify a line parser
        final MessageConstraints constraints = HttpParamConfig.getMessageConstraints(params);
        return new DefaultHttpResponseParser(buffer, null, responseFactory, constraints);
    }
View Full Code Here

        Assert.assertEquals("1234567890123456", CodecTestUtils.convert(dst));
        final Header[] footers = decoder1.getFooters();
        Assert.assertNotNull(footers);
        Assert.assertEquals(1, footers.length);

        final MessageConstraints constraints = MessageConstraints.lineLen(25);
        final ReadableByteChannel channel2 = new ReadableByteChannelMock(
                new String[] {s}, Consts.ASCII);
        final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
                constraints, Consts.ASCII);
        final HttpTransportMetricsImpl metrics2 = new HttpTransportMetricsImpl();
View Full Code Here

        Assert.assertEquals("1234567890123456", CodecTestUtils.convert(dst));
        final Header[] footers = decoder1.getFooters();
        Assert.assertNotNull(footers);
        Assert.assertEquals(4, footers.length);

        final MessageConstraints constraints = MessageConstraints.custom()
                .setMaxHeaderCount(3).build();
        final ReadableByteChannel channel2 = new ReadableByteChannelMock(
                new String[] {s}, Consts.ASCII);
        final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
                constraints, Consts.ASCII);
View Full Code Here

TOP

Related Classes of org.apache.http.config.MessageConstraints$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.