I am working on a fork of Oryx Editor. In oryxRoot\editor\server\src\org\oryxeditor\server
I added a Java servlet in which I try to apply an XSL file to a stream representing an XML document. The code is below:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//get AppML from POST
InputStream inputStream = new ByteArrayInputStream(request.getParameter("content").getBytes("UTF-8"));
inputStream.reset();
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource("lib/SorinCode.xsl"));
transformer.transform(new StreamSource(inputStream), new StreamResult(new FileOutputStream("output.txt")));
System.out.println("************* The result is in output.txt *************");
} catch (Throwable t) {
t.printStackTrace();
}
}
The problem is that new StreamSource("lib/SorinCode.xsl")
expects to find the XSL file in tomcat/bin/lib
, and not in tomcat/webapp/oryx/lib
as I would expect. I tried to change
oryxRoot/editor/etc/context.xml
and add baseDoc="oryx"
, but this didn't help.
Can someone please tell me why the app is looking for the XSL file in the bin
folder and what should I do to make it look in webapps/oryx
?