package io.corbel.lib.ws.filter;

import java.io.IOException;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.corbel.lib.ws.auth.AuthorizationInfo;
import io.corbel.lib.ws.auth.AuthorizationRequestFilter;

public class InformationResponseFilter implements ContainerResponseFilter {

    private static final Logger LOG = LoggerFactory.getLogger(InformationResponseFilter.class);

    @Override
    public void filter(ContainerRequestContext containerRequestContext, ContainerResponseContext containerResponseContext)
            throws IOException {
        Object property = containerRequestContext.getProperty(AuthorizationRequestFilter.AUTHORIZATION_INFO_PROPERTIES_KEY);
        if (property != null) {
            AuthorizationInfo authorizationInfo = (AuthorizationInfo) property;
            LOG.info("Request to {} {} {} result: {}, location: {}, length: {}, from domain: {}, client: {}, user: {}",
                    containerRequestContext.getMethod(), containerRequestContext.getUriInfo().getAbsolutePath(),
                    containerRequestContext.getMediaType(), containerResponseContext.getStatus(), containerResponseContext.getLocation(),
                    containerResponseContext.getLength(), authorizationInfo.getDomainId(), authorizationInfo.getClientId(),
                    authorizationInfo.getUserId());
        }
    }

}

@@ -740,241 +740,80 @@
     
-Object property = containerRequestContext.getProperty(AuthorizationRequestFilter.AUTHORIZATION_INFO_PROPERTIES_KEY);%0A        if (property != null) %7B%0A            AuthorizationInfo authorizationInfo = (AuthorizationInfo) property;%0A    
+String authorizationMsg = getAuthorizationLog(containerRequestContext);%0A
     
@@ -838,11 +838,8 @@
 est 
-to 
 %7B%7D %7B
@@ -883,44 +883,8 @@
 : %7B%7D
-, from domain: %7B%7D, client: %7B%7D, user:
  %7B%7D%22
@@ -1197,41 +1197,468 @@
 h(),
- authorizationInfo.getDomainId(),
+authorizationMsg);%0A    %7D%0A%0A    private String getAuthorizationLog(ContainerRequestContext containerRequestContext) %7B%0A        Object property = containerRequestContext.getProperty(AuthorizationRequestFilter.AUTHORIZATION_INFO_PROPERTIES_KEY);%0A        if (property != null) %7B%0A            AuthorizationInfo authorizationInfo = (AuthorizationInfo) property;%0A            return %22, from domain: %22 + authorizationInfo.getDomainId() +%0A                    %22, client: %22 +
  aut
@@ -1685,17 +1685,18 @@
 ientId()
-,
+ +
 %0A       
@@ -1708,16 +1708,28 @@
         
+%22, user: %22 +
 authoriz
@@ -1749,17 +1749,56 @@
 UserId()
-)
+;%0A        %7D else %7B%0A            return %22%22
 ;%0A      

Improve informationResponseFilter data