use of org.apache.http.client.ClientProtocolException in project vcell by virtualcell.
the class VCellApiClient method createLocationURI.
/**
* from org.apache.http.impl.client.DefaultRedirectStrategy
*
* @param location
* @return
* @throws ProtocolException
*/
private URI createLocationURI(final String location) throws ClientProtocolException {
try {
final URIBuilder b = new URIBuilder(new URI(location).normalize());
final String host = b.getHost();
if (host != null) {
b.setHost(host.toLowerCase(Locale.US));
}
final String path = b.getPath();
if (TextUtils.isEmpty(path)) {
b.setPath("/");
}
return b.build();
} catch (final URISyntaxException ex) {
throw new ClientProtocolException("Invalid redirect URI: " + location, ex);
}
}
use of org.apache.http.client.ClientProtocolException in project jo-client-platform by jo-source.
the class HttpClientStub method post.
private HttpResponse post(final HttpPost request) throws IOException, ClientProtocolException {
postInvocations.incrementAndGet();
final StatusLine status = postStatus.get();
if (status.getStatusCode() == 200) {
try {
queue.put((MessageStub) new ObjectInputStream(request.getEntity().getContent()).readObject());
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
return new BasicHttpResponse(status);
}
Aggregations