I'm working with cxf-rt-frontend-jaxrs 2.4.1...

The ResponseBuilder interface defines two versions of the tag() method, one 
that takes a String and one that takes an EntityTag.  The Javadocs say that the 
String version "is a shortcut for tag(new EntityTag(value))".

They don't generate the same results, though.  One wraps the value in quotes; 
the other doesn't.

If the value of the tag I want to set is foo and I do:
ResponseBuilder bldr = Response.ok();
bldr.tag("foo");
The value of the emitted ETag is:  foo

If I do this, though:
ResponseBuilder bldr = Response.ok();
EntityTag tag = new EntityTag("foo");
bldr.tag(tag);
The value of the emitted ETag is: "foo"

This is because org.apache.cxf.jaxrs.impl.ResponseBuilderImpl uses the 
EntityTag.toString() method to get out the tag value while the String version 
injects the passed String directly.

This is easy to work around (after you figure out what's happening), but it 
does seem to be in violation of the interface.

Should the tag(String) method add the quotes to have consistent behavior with 
the tag(EntityTag) method?

Reply via email to