Search in sources :

Example 1 with Tag

use of org.restlet.data.Tag in project qi4j-sdk by Qi4j.

the class EntityResource method entityHeaders.

private Representation entityHeaders(Representation representation, EntityState entityState) {
    representation.setModificationDate(new Date(entityState.lastModified()));
    representation.setTag(new Tag("" + entityState.version()));
    representation.setCharacterSet(CharacterSet.UTF_8);
    representation.setLanguages(Collections.singletonList(Language.ENGLISH));
    return representation;
}
Also used : Tag(org.restlet.data.Tag) Date(java.util.Date)

Example 2 with Tag

use of org.restlet.data.Tag in project qi4j-sdk by Qi4j.

the class ResourceValidity method updateResponse.

public void updateResponse(Response response) {
    if (entity != null) {
        EntityState state = spi.entityStateOf(entity);
        Date lastModified = new Date(state.lastModified());
        Tag tag = new Tag(state.identity().identity() + "/" + state.version());
        response.getEntity().setModificationDate(lastModified);
        response.getEntity().setTag(tag);
    }
}
Also used : EntityState(org.qi4j.spi.entity.EntityState) Tag(org.restlet.data.Tag) Date(java.util.Date)

Example 3 with Tag

use of org.restlet.data.Tag in project OpenAM by OpenRock.

the class ResourceSetRegistrationEndpoint method generateETag.

private Tag generateETag(ResourceSetDescription resourceSetDescription) {
    int hashCode = resourceSetDescription.hashCode();
    JsonValue description = resourceSetDescription.getDescription();
    if (!description.isDefined(OAuth2Constants.ResourceSets.LABELS)) {
        description.put(OAuth2Constants.ResourceSets.LABELS, null);
        hashCode = resourceSetDescription.hashCode();
        description.remove(OAuth2Constants.ResourceSets.LABELS);
    }
    return new Tag(Integer.toString(hashCode), true);
}
Also used : JsonValue(org.forgerock.json.JsonValue) Tag(org.restlet.data.Tag)

Example 4 with Tag

use of org.restlet.data.Tag in project OpenAM by OpenRock.

the class ResourceSetRegistrationEndpointTest method addCondition.

private void addCondition() {
    Conditions conditions = new Conditions();
    conditions.setMatch(Collections.singletonList(new Tag()));
    given(endpoint.getConditions()).willReturn(conditions);
}
Also used : Tag(org.restlet.data.Tag) Conditions(org.restlet.data.Conditions)

Aggregations

Tag (org.restlet.data.Tag)4 Date (java.util.Date)2 JsonValue (org.forgerock.json.JsonValue)1 EntityState (org.qi4j.spi.entity.EntityState)1 Conditions (org.restlet.data.Conditions)1