/** Called after a resource method is executed */
 @Override
 public void filter(
     ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
   if (activityLog.isEnabled()) {
     try {
       Long entryId =
           (Long) requestContext.getProperty(ActivityConstants.HTTP_HEADER__ACTIVITY_ENTRY_ID);
       if (entryId != null) {
         StatusType statusType = responseContext.getStatusInfo();
         if (statusType.getFamily() == Status.Family.SUCCESSFUL) {
           activityLog.completeEntry(entryId);
         } else {
           activityLog.endEntryAbnormally(entryId, responseContext.getStatus());
         }
       } else {
         // Response was called without a matching request
         activityLog.createActivityThread(
             Activity.JAXRS_METHOD_CALL_FILTER_ERROR,
             ActivityConstants.DEFAULT_ACCOUNT_ID,
             ActivityConstants.DEFAULT_SERVER_ID,
             ActivityConstants.DEFAULT_CLIENT_ID,
             ActivityConstants.ERROR_MSG__MISSING_ACTIVITY_HEADER);
       }
     } catch (Throwable th) {
       logger.error(th, "Error during ActivityContainerResponseFilter");
     }
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * eu.artemis.demanes.lib.ParameterizationProxy#setParameter(eu.artemis.
   * demanes.datatypes.ANES_URN, byte[])
   */
  @Override
  public void setParameter(ANES_URN urn, byte[] value) throws ParameterizationException {
    StatusType status =
        client
            .target(this.target + urnPath + urn.toString())
            .request(MediaType.APPLICATION_OCTET_STREAM)
            .put(Entity.entity(value, MediaType.APPLICATION_OCTET_STREAM))
            .getStatusInfo();

    if (status.getFamily() != Family.SUCCESSFUL)
      throw new ParameterizationLinkException(
          "Error while setting remote urn " + urn + " on remote host " + this.target);
  }
 private void setHeaders(MultivaluedMap<String, Object> headers) {
   this.headers = headers;
   Object location = headers.getFirst(HttpHeaders.LOCATION);
   if (location != null) {
     if (location instanceof URI) {
       final URI locationUri = (URI) location;
       if (!locationUri.isAbsolute()) {
         final URI base =
             (statusType.getStatusCode() == Status.CREATED.getStatusCode())
                 ? request.getAbsolutePath()
                 : request.getBaseUri();
         location =
             UriBuilder.fromUri(base)
                 .path(locationUri.getRawPath())
                 .replaceQuery(locationUri.getRawQuery())
                 .fragment(locationUri.getRawFragment())
                 .build();
       }
       headers.putSingle(HttpHeaders.LOCATION, location);
     }
   }
 }
 @Override
 public int getStatus() {
   return statusType.getStatusCode();
 }
 /**
  * Returns the HTTP status reason message, returns null if the causing error was not an HTTP
  * related exception.
  *
  * @return the HTTP status reason message
  */
 public final String getReason() {
   return (statusInfo != null ? statusInfo.getReasonPhrase() : null);
 }