protected void saveInContext(ApiRequest request, Policy policy, SchemaFactory schemaFactory) { if (schemaFactory != null) { request.setSchemaFactory(schemaFactory); } String accountId = (String) ApiContext.getContext() .getIdFormatter() .formatId(objectManager.getType(Account.class), policy.getAccountId()); request.getServletContext().getResponse().addHeader(ACCOUNT_ID_HEADER, accountId); ApiContext.getContext().setPolicy(policy); }