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

com.tapstream.rollbar.HttpRequest Maven / Gradle / Ivy

There is a newer version: 0.1.4
Show newest version
package com.tapstream.rollbar;

import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public class HttpRequest {

    private final URL url;
    private final Map requestProperties;
    private String method;
    private byte[] body;

    public HttpRequest(URL url, String method) {
        this.url = url;
        this.method = method;
        this.requestProperties = new HashMap();
    }
    
    public URL getUrl(){
        return url;
    }
    
    public String getMethod(){
        return method;
    }

    public void setHeader(String key, String value) {
        requestProperties.put(key, value);
    }
    
    public Map getHeaders(){
        return this.requestProperties;
    }

    public void setBody(String body) {
        try {
            this.body = body.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            this.body = body.getBytes();
        }
    }
    
    public byte[] getBody(){
        return this.body;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy