@Override
    protected void doApply(ApiRequest request, IPolicyContext context, TransformationConfigBean config,
            IPolicyChain<ApiRequest> chain) {
        DataFormat clientFormat = config.getClientFormat();
        DataFormat serverFormat = config.getServerFormat();

        if (isValidTransformation(clientFormat, serverFormat)) {
            context.setAttribute(CLIENT_FORMAT, clientFormat);
            context.setAttribute(SERVER_FORMAT, serverFormat);

            request.getHeaders().put(CONTENT_TYPE, serverFormat.getContentType());
            request.getHeaders().remove(CONTENT_LENGTH);
            
            request.getHeaders().put(ACCEPT, serverFormat.getContentType());
        }

        super.doApply(request, context, config, chain);
    }
Policy that transforms the data from one format to another.

@author Alexandre Kieling {@literal <alex.kieling@gmail.com>}
plugins/transformation-policy/src/main/java/io/apiman/plugins/transformation_policy/TransformationPolicy.java