@Override
    public void apply(final ApiResponse response, IPolicyContext context, Object config,
            final IPolicyChain<ApiResponse> chain) {
        final ISharedStateComponent sharedState = context.getComponent(ISharedStateComponent.class);
        final String namespace = "urn:" + getClass().getName();
        final String propName = "bean-property";
        final DataBean notfound = new DataBean();
        sharedState.getProperty(namespace, propName, notfound, new IAsyncResultHandler<DataBean>() {
            @Override
            public void handle(IAsyncResult<DataBean> result) {
                DataBean value = result.getResult();
                if (value == notfound) {
                    PolicyFailure failure = new PolicyFailure(PolicyFailureType.NotFound, 0, "DataBean not found.");
                    chain.doFailure(failure);
                } else {
                    response.getHeaders().put("X-Property-1", value.getProperty1());
                    response.getHeaders().put("X-Property-2", String.valueOf(value.isProperty2()));
                    response.getHeaders().put("X-Property-3", String.valueOf(value.getProperty3()));
                    chain.doApply(response);
                }
            }
        });
    }
@see io.apiman.gateway.engine.policy.IPolicy#apply(io.apiman.gateway.engine.beans.ApiResponse, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
gateway/test/src/test/java/io/apiman/gateway/test/policies/BeanSharedStatePolicy.java