private Representation representJson( EntityState entityState )
{
if( entityState instanceof JSONEntityState )
{
JSONEntityState jsonState = (JSONEntityState) entityState;
return new StringRepresentation( jsonState.state().toString(), MediaType.APPLICATION_JSON );
}
else
{
throw new ResourceException( Status.CLIENT_ERROR_NOT_ACCEPTABLE );
}