0 Replies Latest reply on Aug 16, 2014 2:11 PM by Savvas Andreas Moysidis

    JAX-RS - ETag preconditions fails

    Savvas Andreas Moysidis Newbie

      Hi,

       

      I am trying to use the ETag preconditions using the Request object but this doesn't seem to work.

       

      I have the following code in one of my resource methods:

       

      EntityTag etag = new EntityTag(String.valueOf(myEntity.hashCode()));

      ResponseBuilder builder = request.evaluatePreconditions(etag);

       

      Now, the evaluatePreconditions(...) method always returns null whether I send a request with no ETag header at all as in:

      Request Headers:

      Connection: keep-alive

      Host: 127.0.0.1:8080

      User-Agent: Apache-HttpClient/4.2.3 (java 1.5)

       

      Or whether I send an ETag header with a random value, as in:

      Request Headers:

      Connection: keep-alive

      ETag: "asdhjkahdajkhds"

      Host: 127.0.0.1:8080

      User-Agent: Apache-HttpClient/4.2.3 (java 1.5)

       

      Or with a header set to the expected value (e.g. the hash code of my entity)

       

      Is this a bug or am I missing something?

       

      (Using WildFly-8.0.0.Final)

       

      Thanks,

      Savvas