Search in sources :

Example 1 with Axis2HttpRequest

use of org.apache.synapse.transport.nhttp.Axis2HttpRequest in project wso2-synapse by wso2.

the class ClientConnectionDebug method recordRequestStartTime.

public void recordRequestStartTime(NHttpClientConnection conn, Axis2HttpRequest axis2Req) {
    if (conn != null) {
        this.connectionCreationTime = (Long) conn.getContext().getAttribute(ClientHandler.CONNECTION_CREATION_TIME);
        try {
            HttpRequest request = axis2Req.getRequest();
            RequestLine requestLine = request.getRequestLine();
            this.lastRequestProtocol = requestLine.getProtocolVersion().toString();
            this.lastRequestHTTPMethod = requestLine.getMethod();
            this.headers = request.getAllHeaders();
        } catch (IOException ignore) {
        } catch (HttpException ignore) {
        }
    }
    if (this.lastRequestStartTime != 0) {
        if (previousRequestAttempts == null) {
            previousRequestAttempts = new StringBuffer();
        } else {
            previousRequestAttempts.append(fieldSeparator);
        }
        previousRequestAttempts.append("Attempt-Info").append(keyValueSeparator).append("{");
        previousRequestAttempts.append("Req-Start-Time").append(keyValueSeparator).append(format(this.lastRequestStartTime));
        previousRequestAttempts.append(fieldSeparator);
        previousRequestAttempts.append("Req-URL").append(keyValueSeparator).append(this.lastRequestEPR).append("}");
    }
    this.lastRequestStartTime = System.currentTimeMillis();
    this.lastRequestEPR = axis2Req.getEpr().toString();
}
Also used : Axis2HttpRequest(org.apache.synapse.transport.nhttp.Axis2HttpRequest) HttpRequest(org.apache.http.HttpRequest) RequestLine(org.apache.http.RequestLine) HttpException(org.apache.http.HttpException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 HttpException (org.apache.http.HttpException)1 HttpRequest (org.apache.http.HttpRequest)1 RequestLine (org.apache.http.RequestLine)1 Axis2HttpRequest (org.apache.synapse.transport.nhttp.Axis2HttpRequest)1