Monday 16 November 2009

Xalan line separator

In Xalan, to set the line separator used in transformed documents

http://xml.apache.org/xalan-j/apidocs/org/apache/xalan/transformer/TransformerImpl.html
#setOutputProperty

Source src = new DOMSource(signatureDoc);
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer tfr = tranFactory.newTransformer();

// Set newline character to \n for all platforms (otherwise will be \r\n on Windows,
// which will break unit tests)
tfr.setOutputProperty("{http://xml.apache.org/xalan}line-separator", "\n");
Result dest = new StreamResult(outputZip);
tfr.transform(src, dest);
outputZip.closeEntry();

Tuesday 10 February 2009

Unresponsive Tomcat

Spring MVC webapp setup in Tomcat, but no requests are getting through to it.

  • Check in %CATALINA_HOME%/conf/Catalina/localhost
  • If there are any problems with the context file, then requests may silently fail.
  • Context file should be named context#path.xml (subpaths separated by #), and no path attribute should be present in the Context element.
  • http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

e.g.

apps#mywebapp.xml


<Context docBase="C:\Data\ebdcportal\target\ebdcportal" reloadable="false">
<!-- See http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html
pathname="" ensures that sessions are not saved/reloaded after
startup --
>
<Manager className="org.apache.catalina.session.StandardManager"
distributable="false"
pathname="" /
>
</Context>