javaxsltxslt-1.0xalanteamsite

Capture generated output file path and name using CSSDK


We are in the process of converting over to using the XSLT compiler for page generation. I have a Xalan Java extention to exploit the CSSDK and capture some meta data we have stored in the Extended Attributes for output to the page. No problems in getting the EA's rendered to the output file.

The problem is that I don't know how to dynamically capture the file path and name of the output file.

So just as POC, I have the CSVPath hard coded to the output file in my Java extension. Here's a code sample:

CSSimpleFile sourceFile = (CSSimpleFile)client.getFile(new CSVPath("/some-path-to-the-output.jsp"));

Can someone point me in the CSSDK to where I could capture the output file?


Solution

  • I found the answer.

    First, get or create your CSClient. You can use the examples provided in the cssdk/samples. I tweaked one so that I captured the CSClient in the method getClientForCurrentUser(). Watch out for SOAP vs Java connections. In development, I was using a SOAP connection and for the make_toolkit build, the Java connection was required for our purposes.

    Check the following snippet. The request CSClient is captured in the static variable client.

    CSSimpleFile sourceFile = (CSSimpleFile)client.getFile(new CSVPath(XSLTExtensionContext.getContext().getOutputDirectory().toString() + "/" + XSLTExtensionContext.getContext().getOutputFileName()));