Package org.apache.http.message

Examples of org.apache.http.message.BasicRequestLine


      sb.append('?');
      sb.append(encodeQuery(query));
     
     
    }
    return new BasicRequestLine(requestLine.getMethod(), sb.toString(), requestLine.getProtocolVersion());
  }
View Full Code Here


            requestUri = this.original.getRequestLine().getUri();
        }
        if (requestUri == null || requestUri.length() == 0) {
            requestUri = "/";
        }
        return new BasicRequestLine(this.method, requestUri, getProtocolVersion());
    }
View Full Code Here

     * @param method request method.
     * @param uri request URI.
     * @param ver HTTP protocol version.
     */
    public BasicExecutionAwareRequest(final String method, final String uri, final ProtocolVersion ver) {
        this(new BasicRequestLine(method, uri, ver));
    }
View Full Code Here

     *
     * @see #BasicHttpRequest(String, String)
     */
    public RequestLine getRequestLine() {
        if (this.requestline == null) {
            this.requestline = new BasicRequestLine(this.method, this.uri, HttpVersion.HTTP_1_1);
        }
        return this.requestline;
    }
View Full Code Here

    public static Test suite() {
        return new TestSuite(TestRequestLine.class);
    }

    public void testConstructor() {
        RequestLine requestline = new BasicRequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
        assertEquals("GET", requestline.getMethod());
        assertEquals("/stuff", requestline.getUri());
        assertEquals(HttpVersion.HTTP_1_1, requestline.getHttpVersion());
    }
View Full Code Here

        assertEquals(HttpVersion.HTTP_1_1, requestline.getHttpVersion());
    }
       
    public void testConstructorInvalidInput() {
        try {
            new BasicRequestLine(null, "/stuff", HttpVersion.HTTP_1_1);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException e) { /* expected */ }
        try {
            new BasicRequestLine("GEt", null, HttpVersion.HTTP_1_1);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException e) { /* expected */ }
        try {
            new BasicRequestLine("GET", "/stuff", (HttpVersion)null);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException e) { /* expected */ }
    }
View Full Code Here

            // expected
        }
    }

    public void testFormatting() throws Exception {
        RequestLine requestline = new BasicRequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
        String s = BasicRequestLine.format(requestline);
        assertEquals("GET /stuff HTTP/1.1", s);
    }
View Full Code Here

        assertEquals("GET /stuff HTTP/1.1", s);
    }
   
    public void testFormattingInvalidInput() throws Exception {
        try {
            BasicRequestLine.format(null, new BasicRequestLine("GET", "/stuff", HttpVersion.HTTP_1_1));
            fail("IllegalArgumentException should habe been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
View Full Code Here

        Assert.assertTrue(requestConsumer instanceof BasicAsyncRequestConsumer);
    }

    @Test
    public void testHandleRequest() throws Exception {
        Mockito.when(this.request.getRequestLine()).thenReturn(new BasicRequestLine("GET", "/", HttpVersion.HTTP_1_0));

        this.asyncRequestHandler.handle(this.request, this.httpexchange, this.context);

        Mockito.verify(this.requestHandler).handle(
                Mockito.eq(this.request), Mockito.eq(this.response), Mockito.eq(this.context));
View Full Code Here

        assertEquals("Not the expected body content", envelope.toString().replace("utf", "UTF"),
                new String(httpResponse.getByteArrayOutputStream().toByteArray()));
    }
   
    public void testInvokeWithAxisHttpResponseImpl() throws Exception {
        RequestLine line = new BasicRequestLine("", "", new ProtocolVersion("http", 1, 0));
        MockHTTPResponse httpResponse = new MockAxisHttpResponse(line);
        SOAPEnvelope envelope = getEnvelope();
        httpResponse = (MockAxisHttpResponse) configAndRun(httpResponse,
                (OutTransportInfo) httpResponse, null, getTransportSender());
View Full Code Here

TOP

Related Classes of org.apache.http.message.BasicRequestLine

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.