ClientInfo preference) {
if (acceptMediaTypeHeader != null) {
try {
PreferenceReader pr = new PreferenceReader(
PreferenceReader.TYPE_MEDIA_TYPE, acceptMediaTypeHeader);
Preference currentPref = pr.readPreference();
while (currentPref != null) {
preference.getAcceptedMediaTypes().add(currentPref);
currentPref = pr.readPreference();
}
} catch (IOException ioe) {
throw new IllegalArgumentException(
"An exception occurred during media type preferences parsing. Header: "
+ acceptMediaTypeHeader + ". Ignoring header.");
}
} else {
preference.getAcceptedMediaTypes().add(
new Preference(MediaType.ALL));
}
}