Author: dkuleshov
Date: 2010-11-16 09:51:45 -0500 (Tue, 16 Nov 2010)
New Revision: 3462
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
Log:
EXOJCR-994: changed XSLTStreamingOutput, added constructor to receive an XSLT parameters
Map
Modified:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java
===================================================================
---
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2010-11-12
13:39:50 UTC (rev 3461)
+++
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/provider/XSLTStreamingOutput.java 2010-11-16
14:51:45 UTC (rev 3462)
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Map;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;
@@ -51,6 +52,8 @@
private Source source;
+ private Map<String, String> xsltParams;
+
/**
* XSLTStreamingOutput constructor.
*
@@ -61,10 +64,23 @@
*/
public XSLTStreamingOutput(String schemeName, Source source)
{
-
this.schemeName = schemeName;
this.source = source;
+ }
+ /**
+ * XSLTStreamingOutput constructor.
+ *
+ * @param schemeName XLST scheme name. Must be registered in
+ * {@link
org.exoplatform.services.xml.transform.impl.trax.TRAXTemplatesLoaderPlugin
+ * TRAXTemplatesLoaderPlugin }
+ * @param source entity to write into output stream.
+ * @param xsltParams XSLT parameters
+ */
+ public XSLTStreamingOutput(String schemeName, Source source, Map<String, String>
xsltParams)
+ {
+ this(schemeName, source);
+ this.xsltParams = xsltParams;
}
/**
@@ -97,6 +113,13 @@
throw new NullPointerException(msg);
}
transformer.initResult(new StreamResult(outStream));
+ if (xsltParams != null)
+ {
+ for (Map.Entry<String, String> e : xsltParams.entrySet())
+ {
+ transformer.setParameter(e.getKey(), e.getValue());
+ }
+ }
transformer.transform(source);
}
catch (TransformerConfigurationException tce)
Show replies by date