Examples of HttpEntityEnclosingRequest


Examples of org.apache.http.HttpEntityEnclosingRequest

        testRequestWithWeakETagValidatorIsNotAllowed("If-Match");
    }

    @Test
    public void testPUTWithIfNoneMatchWeakETagIsNotAllowed() throws Exception {
        final HttpEntityEnclosingRequest put = new BasicHttpEntityEnclosingRequest("PUT", "/", HttpVersion.HTTP_1_1);
        put.setEntity(HttpTestUtils.makeBody(128));
        put.setHeader("Content-Length", "128");
        put.setHeader("If-None-Match", "W/\"etag\"");
        request = HttpRequestWrapper.wrap(put);

        testRequestWithWeakETagValidatorIsNotAllowed("If-None-Match");
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

        unsafeReq.setHeader("Location","http://bar.example.com/content");
        testUnsafeMethodDoesNotInvalidateCacheForHeaderUri(unsafeReq);
    }

    protected HttpRequestWrapper makeRequestWithBody(final String method, final String requestUri) {
        final HttpEntityEnclosingRequest request =
            new BasicHttpEntityEnclosingRequest(method, requestUri, HttpVersion.HTTP_1_1);
        final int nbytes = 128;
        request.setEntity(HttpTestUtils.makeBody(nbytes));
        request.setHeader("Content-Length",""+nbytes);
        return HttpRequestWrapper.wrap(request);
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

    }

    @Test
    public void testPOSTRequestsAreWrittenThroughToOrigin()
        throws Exception {
        final HttpEntityEnclosingRequest req = new BasicHttpEntityEnclosingRequest("POST","/",HttpVersion.HTTP_1_1);
        req.setEntity(HttpTestUtils.makeBody(128));
        req.setHeader("Content-Length","128");
        testRequestIsWrittenThroughToOrigin(req);
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

    }

    @Test
    public void testPUTRequestsAreWrittenThroughToOrigin()
        throws Exception {
        final HttpEntityEnclosingRequest req = new BasicHttpEntityEnclosingRequest("PUT","/",HttpVersion.HTTP_1_1);
        req.setEntity(HttpTestUtils.makeBody(128));
        req.setHeader("Content-Length","128");
        testRequestIsWrittenThroughToOrigin(req);
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

        verifyMocks();

        final HttpRequest forwarded = reqCap.getValue();
        Assert.assertTrue(forwarded instanceof HttpEntityEnclosingRequest);
        final HttpEntityEnclosingRequest reqWithBody = (HttpEntityEnclosingRequest) forwarded;
        final HttpEntity reqBody = reqWithBody.getEntity();
        Assert.assertNotNull(reqBody);
        Assert.assertNotNull(reqBody.getContentType());
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

            HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler, HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, ExecutionContext executionContext)
            throws IOException {

        HttpResponse httpResponse = createResponse(method, request, apacheHttpResponse);
        if (responseHandler.needsConnectionLeftOpen() && method instanceof HttpEntityEnclosingRequest) {
            HttpEntityEnclosingRequest httpEntityEnclosingRequest = (HttpEntityEnclosingRequest)method;
            httpResponse.setContent(new HttpMethodReleaseInputStream(httpEntityEnclosingRequest));
        }

        try {
            CountingInputStream countingInputStream = null;
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

    }

    @SuppressWarnings("deprecation")
    private void parseRequest(HttpRequest request) throws IOException {
        if(request instanceof HttpEntityEnclosingRequest) {
            HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest)request;

            String body = EntityUtils.toString(entityRequest.getEntity());
            if(body != null) {
                String[] paramArray = body.split("&");
                if(paramArray != null) {
                    for (String paramEntry : paramArray) {
                        String[] paramValue = paramEntry.split("=");
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

     * @param request HttpRequest
     * @return
     */
    public HttpEntity getEnclosedEntity(final HttpRequest request) {
        if (request instanceof HttpEntityEnclosingRequest) {
            final HttpEntityEnclosingRequest erequest = (HttpEntityEnclosingRequest) request;
            final HttpEntity entity = erequest.getEntity();
            return entity;
        }
        return null;
    }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

 
 
  @Test
  public void testParseRequestHttpRequest() throws Exception {
    HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/test.html");
    request.setEntity(new StringEntity(""));
    String CONTENT_TYPE = "multipart/form-data; boundary=---1234";
    request.addHeader(HTTP.CONTENT_TYPE, CONTENT_TYPE);
    upload.parseRequest(request);
  }
View Full Code Here

Examples of org.apache.http.HttpEntityEnclosingRequest

    upload.parseRequest(request);
  }

  @Test
  public void testParseRequestRequestContext() throws Exception {
    HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/test.html");
    request.setEntity(new StringEntity(""));
    String CONTENT_TYPE = "multipart/form-data; boundary=---1234";
    request.addHeader(HTTP.CONTENT_TYPE, CONTENT_TYPE);
   
    HttpRequestContext ctx = new HttpRequestContext(request);
    try {
      upload.parseRequest(ctx);
    } catch (NullPointerException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.