Example usage for org.apache.http.client.fluent Request toString

List of usage examples for org.apache.http.client.fluent Request toString

Introduction

In this page you can find the example usage for org.apache.http.client.fluent Request toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.qwazr.utils.json.client.JsonClientAbstract.java

/**
 * {@inheritDoc}/*  w w w.  j a  v a 2  s  .  co  m*/
 */
@Override
final public HttpResponse execute(Request request, Object bodyObject, Integer msTimeOut) throws IOException {
    if (logger.isDebugEnabled())
        logger.debug(request.toString());
    if (msTimeOut == null)
        msTimeOut = this.timeout;
    request = setBodyString(request, bodyObject);
    return executor.execute(request.connectTimeout(msTimeOut).socketTimeout(msTimeOut)).returnResponse();
}

From source file:com.qwazr.utils.json.client.JsonClientAbstract.java

/**
 * {@inheritDoc}/* w  ww . ja va  2  s. c  o m*/
 */
@Override
final public JsonNode execute(Request request, Object bodyObject, Integer msTimeOut, int... expectedCodes)
        throws IOException {
    if (logger.isDebugEnabled())
        logger.debug(request.toString());
    if (msTimeOut == null)
        msTimeOut = this.timeout;
    request = setBodyString(request, bodyObject);
    return executor
            .execute(request.connectTimeout(msTimeOut).socketTimeout(msTimeOut).addHeader("accept",
                    ContentType.APPLICATION_JSON.toString()))
            .handleResponse(
                    new JsonHttpResponseHandler.JsonTreeResponse(ContentType.APPLICATION_JSON, expectedCodes));
}

From source file:com.qwazr.utils.json.client.JsonClientAbstract.java

/**
 * {@inheritDoc}//from www  . j ava 2 s  .  c om
 */
@Override
final public <T> T execute(Request request, Object bodyObject, Integer msTimeOut, Class<T> jsonResultClass,
        int... expectedCodes) throws IOException {
    if (logger.isDebugEnabled())
        logger.debug(request.toString());
    if (msTimeOut == null)
        msTimeOut = this.timeout;
    request = setBodyString(request, bodyObject);
    JsonHttpResponseHandler.JsonValueResponse<T> responseHandler = new JsonHttpResponseHandler.JsonValueResponse<T>(
            ContentType.APPLICATION_JSON, jsonResultClass, expectedCodes);
    return executor.execute(request.connectTimeout(msTimeOut).socketTimeout(msTimeOut).addHeader("Accept",
            ContentType.APPLICATION_JSON.toString())).handleResponse(responseHandler);
}

From source file:com.qwazr.utils.json.client.JsonClientAbstract.java

/**
 * {@inheritDoc}/*from  w ww .j  av  a 2  s  .c o  m*/
 */
@Override
final public <T> T execute(Request request, Object bodyObject, Integer msTimeOut, TypeReference<T> typeRef,
        int... expectedCodes) throws IOException {
    if (logger.isDebugEnabled())
        logger.debug(request.toString());
    if (msTimeOut == null)
        msTimeOut = this.timeout;
    request = setBodyString(request, bodyObject);
    return executor
            .execute(request.connectTimeout(msTimeOut).socketTimeout(msTimeOut).addHeader("accept",
                    ContentType.APPLICATION_JSON.toString()))
            .handleResponse(new JsonHttpResponseHandler.JsonValueTypeRefResponse<T>(
                    ContentType.APPLICATION_JSON, typeRef, expectedCodes));
}