private String getFormatFromRequestOrNegotiation(HttpServletRequest request) {
String fromRequest = getFormatFromRequest(request);
if (fromRequest != null && !"".equals(fromRequest) && !"best".equals(fromRequest)) {
return fromRequest;
}
MediaRangeSpec result = Any23Negotiator.getNegotiator().getBestMatch(request.getHeader("Accept"));
if (result == null) {
return null;
}
else if (RDFFormat.TURTLE.hasMIMEType(result.getMediaType())) {
return "turtle";
}
else if (RDFFormat.N3.hasMIMEType(result.getMediaType())) {
return "n3";
}
else if (RDFFormat.NQUADS.hasMIMEType(result.getMediaType())) {
return "nq";
}
else if (RDFFormat.RDFXML.hasMIMEType(result.getMediaType())) {
return "rdf";
}
else if (RDFFormat.NTRIPLES.hasMIMEType(result.getMediaType())) {
return "nt";
}
else {
return "turtle"; // shouldn't happen
}