protected Templates getAnnotationTemplates(Annotation[] anns) {
   Templates t = null;
   XSLTTransform ann = AnnotationUtils.getAnnotation(anns, XSLTTransform.class);
   if (ann != null) {
     t = annotationTemplates.get(ann.value());
   }
   return t;
 }
 protected Templates getTemplatesFromAnnotation(Class<?> cls, Annotation[] anns, MediaType mt) {
   Templates t = null;
   XSLTTransform ann = getXsltTransformAnn(anns, mt);
   if (ann != null) {
     t = annotationTemplates.get(ann.value());
     if (t == null || refreshTemplates) {
       String path = ann.value();
       final String cp = "classpath:";
       if (!path.startsWith(cp)) {
         path = cp + path;
       }
       t = createTemplates(path);
       if (t == null) {
         createTemplates(ClassLoaderUtils.getResource(ann.value(), cls));
       }
       if (t != null) {
         annotationTemplates.put(ann.value(), t);
       }
     }
   }
   return t;
 }
Esempio n. 3
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);
   }
 }