code: @Override
  	public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
  		Object response = responseContext.getEntity();
  		if (response == null) {
  			return;
  		}
  		
  		// only modify responses which contain a single or a list of Katharsis resources
  		if (isResourceResponse(response)) {
  			KatharsisBoot boot = feature.getBoot();
  			ResourceRegistry resourceRegistry = boot.getResourceRegistry();
  			DocumentMapper documentMapper = boot.getDocumentMapper();
  			
  			ServiceUrlProvider serviceUrlProvider = resourceRegistry.getServiceUrlProvider();
  			try {
  				UriInfo uriInfo = requestContext.getUriInfo();
  				if (serviceUrlProvider instanceof UriInfoServiceUrlProvider) {
  					((UriInfoServiceUrlProvider) serviceUrlProvider).onRequestStarted(uriInfo);
  				}
  
  				JsonApiResponse jsonApiResponse = new JsonApiResponse();
  				jsonApiResponse.setEntity(response);
  				// use the Katharsis document mapper to create a JSON API response
  				responseContext.setEntity(documentMapper.toDocument(jsonApiResponse, null));
  				responseContext.getHeaders().put("Content-Type", Arrays.asList((Object)JsonApiMediaType.APPLICATION_JSON_API));
  				
  			}
  			finally {
  				if (serviceUrlProvider instanceof UriInfoServiceUrlProvider) {
  					((UriInfoServiceUrlProvider) serviceUrlProvider).onRequestFinished();
  				}
  			}
  		}
  	}
docs: Creates JSON API responses for custom JAX-RS actions returning Katharsis resources.