use of org.restlet.representation.Variant in project vcell by virtualcell.
the class AbstractServerResource method getWadlVariants.
@Override
protected List<Variant> getWadlVariants() {
ArrayList<Variant> variants = new ArrayList<Variant>();
variants.add(new Variant(MediaType.APPLICATION_WADL));
return variants;
}
use of org.restlet.representation.Variant in project qi4j-sdk by Qi4j.
the class AbstractResponseWriter method getVariant.
protected Variant getVariant(Request request, List<Language> possibleLanguages, List<MediaType> possibleMediaTypes) {
Language language = request.getClientInfo().getPreferredLanguage(possibleLanguages);
if (language == null) {
language = possibleLanguages.get(0);
}
MediaType responseType = request.getClientInfo().getPreferredMediaType(possibleMediaTypes);
if (responseType == null && request.getClientInfo().getPreferredMediaType(Collections.singletonList(MediaType.ALL)) == MediaType.ALL) {
responseType = possibleMediaTypes.get(0);
}
Variant variant = new Variant(responseType, language);
variant.setCharacterSet(CharacterSet.UTF_8);
return variant;
}