use of org.glassfish.jersey.client.ClientRequest in project jersey by jersey.
the class JettyConnector method translateRequest.
private Request translateRequest(final ClientRequest clientRequest) {
final HttpMethod method = HttpMethod.fromString(clientRequest.getMethod());
if (method == null) {
throw new ProcessingException(LocalizationMessages.METHOD_NOT_SUPPORTED(clientRequest.getMethod()));
}
final URI uri = clientRequest.getUri();
final Request request = client.newRequest(uri);
request.method(method);
request.followRedirects(clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true));
final Object readTimeout = clientRequest.getConfiguration().getProperties().get(ClientProperties.READ_TIMEOUT);
if (readTimeout != null && readTimeout instanceof Integer && (Integer) readTimeout > 0) {
request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS);
}
return request;
}
Aggregations