Package org.apache.http.client

Examples of org.apache.http.client.ClientProtocolException


        }

        try {
            return director.execute(target, request, execContext);
        } catch(HttpException httpException) {
            throw new ClientProtocolException(httpException);
        }
    } // execute
View Full Code Here


   
    Assert.assertFalse(wsResponse.wasCallAllowed());
  }
 
  public void validatePackagingOfClientProtocalException() throws ApplicationException, IOException {
    ClientProtocolException cpe = new ClientProtocolException("Abstract HTTP protocol error");
    TestWSGetClient testWSClient = getTestWSClient(cpe);
    WSResponse response = testWSClient.testCall();

    Assert.assertTrue(response.wasCallAllowed());
    Assert.assertFalse(response.wasCallSuccessful());
View Full Code Here

        URI requestURI = request.getURI();
        if (requestURI.isAbsolute()) {
            target = URIUtils.extractHost(requestURI);
            if (target == null) {
                throw new ClientProtocolException(
                        "URI does not specify a valid host name: " + requestURI);
            }
        }
        return target;
    }
View Full Code Here

        }

        try {
            return director.execute(target, request, execContext);
        } catch(HttpException httpException) {
            throw new ClientProtocolException(httpException);
        }
    }
View Full Code Here

            }
            return revalidateCacheEntry(target, request, context, entry);
        } catch (IOException ioex) {
            return handleRevalidationFailure(request, context, entry, now);
        } catch (ProtocolException e) {
            throw new ClientProtocolException(e);
        }
    }
View Full Code Here

        if (request.getFirstHeader(HeaderConstants.RANGE) != null
                || response.getStatusLine().getStatusCode() != HttpStatus.SC_PARTIAL_CONTENT)
            return;
       
        consumeBody(response);
        throw new ClientProtocolException(UNEXPECTED_PARTIAL_CONTENT);
    }
View Full Code Here

                ((RequestWrapper)request).getOriginal() : request;
        if (originalRequest instanceof HttpEntityEnclosingRequest) {
            if (((HttpEntityEnclosingRequest)originalRequest).expectContinue()) return;
        }
        consumeBody(response);
        throw new ClientProtocolException(UNEXPECTED_100_CONTINUE);
    }
View Full Code Here

    }

    @Test
    public void testNonCompliantRequestWrapsAndReThrowsProtocolException() throws Exception {

        ClientProtocolException expected = new ClientProtocolException("ouch");

        requestIsFatallyNonCompliant(null);
        requestCannotBeMadeCompliantThrows(expected);

        boolean gotException = false;
View Full Code Here

    }

    @Test
    public void testNonCompliantRequestWrapsAndReThrowsProtocolException() throws Exception {

        final ClientProtocolException expected = new ClientProtocolException("ouch");

        requestIsFatallyNonCompliant(null);
        mockRequestProtocolCompliance.makeRequestCompliant((HttpRequestWrapper) anyObject());
        expectLastCall().andThrow(expected);
View Full Code Here

            };

            final BasicFuture<HttpResponse> compositeFuture = new BasicFuture<HttpResponse>(chainedFutureCallback);
            revalidateCacheEntry(compositeFuture, target, request, clientContext, entry);
        } catch (final ProtocolException e) {
            throw new ClientProtocolException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.http.client.ClientProtocolException

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.