use of org.glassfish.jersey.message.internal.HttpHeaderReader.Event in project jersey by jersey.
the class EntityTagProvider method fromString.
@Override
public EntityTag fromString(String header) {
throwIllegalArgumentExceptionIfNull(header, LocalizationMessages.ENTITY_TAG_IS_NULL());
try {
HttpHeaderReader reader = HttpHeaderReader.newInstance(header);
Event e = reader.next(false);
if (e == Event.QuotedString) {
return new EntityTag(reader.getEventValue().toString());
} else if (e == Event.Token) {
final CharSequence ev = reader.getEventValue();
if (ev != null && ev.length() > 0 && ev.charAt(0) == 'W') {
reader.nextSeparator('/');
return new EntityTag(reader.nextQuotedString().toString(), true);
}
}
} catch (ParseException ex) {
throw new IllegalArgumentException("Error parsing entity tag '" + header + "'", ex);
}
throw new IllegalArgumentException("Error parsing entity tag '" + header + "'");
}
Aggregations