private boolean canServiceProduce(final HttpRequest request) { if (getResourceFunction().getProducesAnnotations().isEmpty()) { // if there are no constraints we can produce anything return true; } else { for (final ProducesAnnotation producesAnnotation : getResourceFunction().getProducesAnnotations()) { if (producesAnnotation.matchesMediaType(request)) { return true; } } } return false; }
/** * @see org.exquery.restxq.RestXqService#maxProducesQualityFactor(org.exquery.http.AcceptHeader) */ @Override public float maxProducesQualityFactor(final AcceptHeader acceptHeader) { // if there are no produces annotations, the quality factor is zero float max = 0; for (final Accept accept : acceptHeader.getAccepts()) { for (final ProducesAnnotation producesAnnotation : getResourceFunction().getProducesAnnotations()) { if (producesAnnotation.matchesMediaType(accept.getMediaRange())) { if (accept.getQualityFactor() > max) { max = accept.getQualityFactor(); } } } } return max; }