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

oauth.signpost.basic.HttpRequestAdapter Maven / Gradle / Ivy

package oauth.signpost.basic;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;

import oauth.signpost.http.HttpRequest;

public class HttpRequestAdapter implements HttpRequest {

    protected HttpURLConnection connection;

    public HttpRequestAdapter(HttpURLConnection connection) {
        this.connection = connection;
    }

    public String getMethod() {
        return connection.getRequestMethod();
    }

    public String getRequestUrl() {
        return connection.getURL().toExternalForm();
    }

    public void setHeader(String name, String value) {
        connection.setRequestProperty(name, value);
    }

    public String getHeader(String name) {
        return connection.getRequestProperty(name);
    }

    public InputStream getMessagePayload() throws IOException {
        return null;
    }

    public String getContentType() {
        return connection.getRequestProperty("Content-Type");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy