class SubjectAttributesResourceV1 extends RealmAwareResource {

    @Override
    public Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request,
            QueryResourceHandler handler) {
        final Subject mySubject = getContextSubject(context);
        if (mySubject == null) {
            debug.error("SubjectAttributesResource :: QUERY : Unknown Subject");
            return new BadRequestException().asPromise();
        }
        final String principalName = PrincipalRestUtils.getPrincipalNameFromSubject(mySubject);
        final SubjectAttributesManager manager = getSubjectAttributesManager(mySubject, getRealm(context));
        final Set<String> attributes;
        try {
            attributes = manager.getAvailableSubjectAttributeNames();
        } catch (EntitlementException e) {
            debug.error("SubjectAttributesResource :: QUERY by " + principalName + " : Unable to query available " +
                    "subject attribute names.");
            return new InternalServerErrorException().asPromise();
        }
        for (String attr : attributes) {
            handler.handleResource(newResourceResponse(attr, Long.toString(System.currentTimeMillis()), JsonValue.json(attr)));
        }
        return newResultPromise(newQueryResponse(null, CountPolicy.EXACT, 0));
    }

    @Inject public  SubjectAttributesResourceV1(@Named("frRest") Debug debug);

}