/** Postprocess all the REST requests.. Add an entry into the audit log for every rest service */
  public void postProcess(ServerResponse response) {
    logger.debug("AuditRestInterceptor:postProcess IN");

    try {
      String serviceUrl = InterceptorUtilities.getServiceUrl(request);
      HashMap<String, String> parameters =
          InterceptorUtilities.getRequestParameters(request, servletRequest);
      Object responseBody = response.getEntity();
      if (responseBody != null) {
        String responseBodyString = response.getEntity().toString();
        parameters.put("Response Body", responseBodyString);
      }

      UserProfile profile =
          (UserProfile) servletRequest.getSession().getAttribute(IEngUserProfile.ENG_USER_PROFILE);

      String actionCode =
          "[Service:"
              + serviceUrl
              + " ; Class:"
              + response.getResourceClass()
              + " ; Method:"
              + response.getResourceMethod()
              + "]";
      String result = "";
      if (response.getStatus() == 200) {
        result = "OK";
      } else {
        result = "ERR (" + response.getStatus() + ")";
      }
      AuditLogUtilities.updateAudit(servletRequest, profile, actionCode, parameters, result);
    } catch (Exception e) {
      logger.error("Error updating audit", e);
    } finally {
      logger.debug("AuditRestInterceptor:postProcess OUT");
    }
  }
  @Override
  public void postProcess(ServerResponse response) {
    if (response.getEntity() != null) {
      return; // let the MBW handle this
    }

    MultivaluedMap<String, Object> headers = response.getMetadata();
    List<DKIMSignature> list = getHeaders(headers);

    for (DKIMSignature dosetaSignature : list) {
      try {
        sign(null, headers, null, dosetaSignature);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }