Search in sources :

Example 1 with HttpRequest

use of org.xdi.oxauth.audit.debug.entity.HttpRequest in project oxAuth by GluuFederation.

the class ServletLoggingFilter method getRequestDescription.

protected String getRequestDescription(RequestWrapper requestWrapper) {
    HttpRequest httpRequest = new HttpRequest();
    httpRequest.setSenderIP(requestWrapper.getLocalAddr());
    httpRequest.setMethod(requestWrapper.getMethod());
    httpRequest.setPath(requestWrapper.getRequestURI());
    httpRequest.setParams(requestWrapper.isFormPost() ? null : requestWrapper.getParameters());
    httpRequest.setHeaders(requestWrapper.getHeaders());
    httpRequest.setBody(requestWrapper.getContent());
    try {
        return OBJECT_MAPPER.writeValueAsString(httpRequest);
    } catch (JsonProcessingException e) {
        log.warn("Cannot serialize Request to JSON", e);
        return null;
    }
}
Also used : HttpRequest(org.xdi.oxauth.audit.debug.entity.HttpRequest) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 HttpRequest (org.xdi.oxauth.audit.debug.entity.HttpRequest)1