Example usage for org.apache.commons.httpclient HttpMethodBase getClass

List of usage examples for org.apache.commons.httpclient HttpMethodBase getClass

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpMethodBase getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.httpobjects.proxy.Proxy.java

protected Response proxyRequest(Request req, final HttpMethodBase method) {
    method.setFollowRedirects(false);//from  w  w w.  ja va 2s. com

    String path = req.path().valueFor("path");
    if (!path.startsWith("/"))
        path = "/" + path;
    String query = getQuery(req);
    if (query == null) {
        query = "";
    } else {
        query = "?" + query;
    }
    String url = base + path + query;
    log.debug("doing a " + method.getClass().getSimpleName() + " for " + url);
    //      log.debug("Content type is " + req.representation().contentType());
    try {
        method.setURI(new URI(processUrl(url), true));
    } catch (URIException e1) {
        throw new RuntimeException("Error with uri: " + url, e1);
    }

    addRequestHeaders(req, method);

    if (req.representation().contentType() != null) {
        method.addRequestHeader("Content-Type", req.representation().contentType());
    }

    for (Header next : method.getRequestHeaders()) {
        log.debug("Sending header: " + next);
    }

    HttpClient client = createHttpClient();

    return executeMethod(client, method, req);

}

From source file:org.review_board.ereviewboard.core.client.ReviewboardHttpClient.java

private int executeRequest(HttpMethodBase request, IProgressMonitor monitor) throws ReviewboardException {
    HostConfiguration hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor);
    try {//from w  w w.j ava  2  s  . c  o m
        return WebUtil.execute(httpClient, hostConfiguration, request, monitor);
    } catch (IOException e) {
        throw new ReviewboardException("Exception executing " + request.getClass().getSimpleName() + " on "
                + constructUri(request) + " : " + e.getMessage(), e);
    }
}