JdomRepresentation

public class JdomRepresentation extends WriterRepresentation

The Restlet Extension (restlet.ext) packages support two implementations of the xml API DOM and SAX - w3c.DOM and oracle’s JAXP. Both of them are implementations of API which are not primarily designed for java implementation and thus are a bit awkward to handle. This class provides support for JDOM - an genuine java xml processor (http://www.jdom.org/). It extends restlet.representation.WriterRepresentation and overrides its write(Writer writer) method. This method is called by the Restlet API. It commits a Writer to which the generated Document document is written by the jdom.outputter.output(document writer) The JdomRepresentation may be implemented as @Get, @Put, @Delete ... methods in a ServerResource class, which have to return an xml document.

Author:

Timm Fitschen

Constructors

JdomRepresentation

public JdomRepresentation(Document document, String indent, String xslPath)

Constructor.

Parameters:
  • document – A JDOM Document parsed from elsewhere.

  • indent – Usually a number of whitespaces for better human readbility.

  • xslPath – A String containing a meaningful path to a xslt file.

Methods

addStyleSheet

protected final void addStyleSheet(Document document, String xslPath)

adds the xslt processing instruction to the document.

getWebUIRef

public static final String getWebUIRef(Reference reference)

write

public void write(Writer writer)

write

public void write(OutputStream out)