public AbstractXSLTInterceptor(String phase, Class<?> before, Class<?> after, String xsltPath) { super(phase); if (before != null) { addBefore(before.getName()); } if (after != null) { addAfter(after.getName()); } try { InputStream xsltStream = ClassLoaderUtils.getResourceAsStream(xsltPath, this.getClass()); if (xsltStream == null) { throw new IllegalArgumentException("Cannot load XSLT from path: " + xsltPath); } Document doc = StaxUtils.read(xsltStream); TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (javax.xml.transform.TransformerConfigurationException ex) { // } xsltTemplate = transformerFactory.newTemplates(new DOMSource(doc)); } catch (TransformerConfigurationException | XMLStreamException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s", xsltPath), e); } }
public AbstractXSLTInterceptor(String phase, Class<?> before, Class<?> after, String xsltPath) { super(phase); if (before != null) { addBefore(before.getName()); } if (after != null) { addAfter(after.getName()); } try { InputStream xsltStream = ClassLoaderUtils.getResourceAsStream(xsltPath, this.getClass()); if (xsltStream == null) { throw new IllegalArgumentException("Cannot load XSLT from path: " + xsltPath); } Document doc = StaxUtils.read(xsltStream); TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (javax.xml.transform.TransformerConfigurationException ex) { // } xsltTemplate = transformerFactory.newTemplates(new DOMSource(doc)); } catch (TransformerConfigurationException | XMLStreamException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s", xsltPath), e); } }
public AbstractXSLTInterceptor(String phase, Class<?> before, Class<?> after, String xsltPath) { super(phase); if (before != null) { addBefore(before.getName()); } if (after != null) { addAfter(after.getName()); } try { InputStream xsltStream = ClassLoaderUtils.getResourceAsStream(xsltPath, this.getClass()); if (xsltStream == null) { throw new IllegalArgumentException("Cannot load XSLT from path: " + xsltPath); } Document doc = StaxUtils.read(xsltStream); xsltTemplate = TRANSFORM_FACTORIY.newTemplates(new DOMSource(doc)); } catch (TransformerConfigurationException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s, error: ", xsltPath, e.getException()), e); } catch (XMLStreamException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s, error: ", xsltPath, e.getNestedException()), e); } }
public AbstractXSLTInterceptor(String phase, Class<?> before, Class<?> after, String xsltPath) { super(phase); if (before != null) { addBefore(before.getName()); } if (after != null) { addAfter(after.getName()); } try { InputStream xsltStream = ClassLoaderUtils.getResourceAsStream(xsltPath, this.getClass()); if (xsltStream == null) { throw new IllegalArgumentException("Cannot load XSLT from path: " + xsltPath); } Document doc = StaxUtils.read(xsltStream); xsltTemplate = TRANSFORM_FACTORIY.newTemplates(new DOMSource(doc)); } catch (TransformerConfigurationException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s, error: ", xsltPath, e.getException()), e); } catch (XMLStreamException e) { throw new IllegalArgumentException( String.format("Cannot create XSLT template from path: %s, error: ", xsltPath, e.getNestedException()), e); } }