Example usage for org.apache.http.impl.execchain RequestAbortedException getMessage

List of usage examples for org.apache.http.impl.execchain RequestAbortedException getMessage

Introduction

In this page you can find the example usage for org.apache.http.impl.execchain RequestAbortedException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:leap.lang.http.client.apache.ApacheHttpRequest.java

@Override
public void send(HttpHandler handler) {
    String url = buildRequestUrl();
    try {/*from  w  ww.  ja  va  2s. com*/
        newRequest(url);

        handler.beforeRequest(this);

        log.debug("Sending '{}' request to '{}'...", method, url);

        rawClient.execute(request, r -> {

            ApacheHttpResponse response = new ApacheHttpResponse(client, this, r, false);

            if (log.isDebugEnabled()) {
                log.debug("Handling response : [status={}, content-type='{}', content-length={}]",
                        response.getStatus(), response.getContentType(), response.getContentLength());
            }

            handler.afterResponse(this, response);
            return null;
        });
    } catch (RequestAbortedException e) {
        handler.afterAborted(this);
    } catch (Exception e) {
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        }
        throw new HttpException(e.getMessage(), e);
    } finally {
        release();
    }
}