All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.mklinger.qetcher.client.httpclient.internal.jetty.JettyHttpRequest Maven / Gradle / Ivy

There is a newer version: 2.0.42.rc
Show newest version
package de.mklinger.commons.httpclient.internal.jetty;

import java.net.URI;
import java.time.Duration;
import java.util.Optional;

import org.eclipse.jetty.client.api.Request;

import de.mklinger.commons.httpclient.HttpHeaders;
import de.mklinger.commons.httpclient.HttpRequest;

/**
 * @author Marc Klinger - mklinger[at]mklinger[dot]de
 */
public class JettyHttpRequest implements HttpRequest {
	private final Request jettyRequest;

	public JettyHttpRequest(final Request jettyRequest) {
		this.jettyRequest = jettyRequest;
	}

	@Override
	public Optional bodyProvider() {
		throw new UnsupportedOperationException();
	}

	@Override
	public String method() {
		return jettyRequest.getMethod();
	}

	@Override
	public Optional timeout() {
		return Optional.of(Duration.ofMillis(jettyRequest.getTimeout()));
	}

	@Override
	public URI uri() {
		return jettyRequest.getURI();
	}

	@Override
	public HttpHeaders headers() {
		return HeadersTransformation.toHttpHeaders(jettyRequest.getHeaders());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy