Example #1
0
 private void addXslProcessingInstruction(Marshaller ms, MediaType mt, XSLTTransform ann)
     throws Exception {
   if (ann.type() == XSLTTransform.TransformType.CLIENT
       || ann.type() == XSLTTransform.TransformType.BOTH && ann.mediaTypes().length > 0) {
     for (String s : ann.mediaTypes()) {
       if (mt.isCompatible(JAXRSUtils.toMediaType(s))) {
         return;
       }
     }
     String absRef = resolveXMLResourceURI(ann.value());
     String xslPi = "<?xml-stylesheet type=\"text/xsl\" href=\"" + absRef + "\"?>";
     setXmlPiProperty(ms, xslPi);
   }
 }
 protected XSLTTransform getXsltTransformAnn(Annotation[] anns, MediaType mt) {
   XSLTTransform ann = AnnotationUtils.getAnnotation(anns, XSLTTransform.class);
   if (ann != null && ann.type() != XSLTTransform.TransformType.CLIENT) {
     if (ann.mediaTypes().length > 0) {
       for (String s : ann.mediaTypes()) {
         if (mt.isCompatible(JAXRSUtils.toMediaType(s))) {
           return ann;
         }
       }
       return null;
     }
     return ann;
   }
   return null;
 }