org.restlet.ext.wadl
Class WadlRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.representation.CharacterRepresentation
                  extended by org.restlet.representation.WriterRepresentation
                      extended by org.restlet.ext.xml.XmlRepresentation
                          extended by org.restlet.ext.xml.SaxRepresentation
                              extended by org.restlet.ext.wadl.WadlRepresentation
All Implemented Interfaces:
NamespaceContext

public class WadlRepresentation
extends SaxRepresentation

Root of a WADL description document. For the getHtmlRepresentation() method to work properly, you will certainly have to update your classpath with a recent version of Apache Xalan XSLT engine (version 2.7.1 has been successfully tested). This is due to the XSLT stylesheet bundled which relies on EXSLT features.

Author:
Jerome Louvel

Field Summary
static String APP_NAMESPACE
          Web Application Description Language namespace.
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
WadlRepresentation()
          Constructor.
WadlRepresentation(ApplicationInfo application)
          Constructor.
WadlRepresentation(Representation xmlRepresentation)
          Constructor.
WadlRepresentation(ResourceInfo resource)
          Constructor.
 
Method Summary
 Object evaluate(String expression, QName returnType)
          Evaluates an XPath expression and returns the result as in the given return type.
 ApplicationInfo getApplication()
          Returns the root element of the WADL document.
 Representation getHtmlRepresentation()
          Returns an HTML representation.
 void setApplication(ApplicationInfo application)
          Sets the root element of the WADL document.
 void write(XmlWriter writer)
          Writes the representation to a XML writer.
 
Methods inherited from class org.restlet.ext.xml.SaxRepresentation
getInputSource, getSaxSource, isSecureProcessing, parse, release, setSaxSource, setSecureProcessing, write
 
Methods inherited from class org.restlet.ext.xml.XmlRepresentation
getBoolean, getDocument, getDocumentBuilder, getDomSource, getEntityResolver, getErrorHandler, getNamespaces, getNamespaceURI, getNode, getNodes, getNumber, getPrefix, getPrefixes, getSaxSource, getSchema, getStreamSource, getText, isCoalescing, isExpandingEntityRefs, isIgnoringComments, isIgnoringExtraWhitespaces, isNamespaceAware, isValidatingDtd, isXIncludeAware, setCoalescing, setEntityResolver, setErrorHandler, setExpandingEntityRefs, setIgnoringComments, setIgnoringExtraWhitespaces, setNamespaceAware, setNamespaces, setSchema, setSchema, setValidatingDtd, setXIncludeAware, validate, validate, validate, validate
 
Methods inherited from class org.restlet.representation.WriterRepresentation
getReader
 
Methods inherited from class org.restlet.representation.CharacterRepresentation
getChannel, getStream, write, write
 
Methods inherited from class org.restlet.representation.Representation
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

APP_NAMESPACE

public static final String APP_NAMESPACE
Web Application Description Language namespace.

See Also:
Constant Field Values
Constructor Detail

WadlRepresentation

public WadlRepresentation()
Constructor.


WadlRepresentation

public WadlRepresentation(ApplicationInfo application)
Constructor.

Parameters:
application - The root element of the WADL document.

WadlRepresentation

public WadlRepresentation(Representation xmlRepresentation)
                   throws IOException
Constructor.

Parameters:
xmlRepresentation - The XML WADL document.
Throws:
IOException

WadlRepresentation

public WadlRepresentation(ResourceInfo resource)
Constructor. The title of the resource, that is to say the title of its first documentation tag is transfered to the title of the first documentation tag of the main application tag.

Parameters:
resource - The root element of the WADL document.
Method Detail

evaluate

public Object evaluate(String expression,
                       QName returnType)
                throws Exception
Description copied from class: XmlRepresentation
Evaluates an XPath expression and returns the result as in the given return type.

Overrides:
evaluate in class XmlRepresentation
returnType - The qualified name of the return type.
Returns:
The evaluation result.
Throws:
Exception
See Also:
XPathException, XPathConstants

getApplication

public ApplicationInfo getApplication()
Returns the root element of the WADL document.

Returns:
The root element of the WADL document.

getHtmlRepresentation

public Representation getHtmlRepresentation()
Returns an HTML representation. Note that the internal XSLT stylesheet used comes from Mark Nottingham. This stylesheet requires advanced XSLT features, including EXSLT extensions. Usage of a recent version of Xalan-J is suggested. It has been tested successfully with Xalan-J 2.7.1.

Returns:
An HTML representation.

setApplication

public void setApplication(ApplicationInfo application)
Sets the root element of the WADL document.

Parameters:
application - The root element of the WADL document.

write

public void write(XmlWriter writer)
           throws IOException
Description copied from class: SaxRepresentation
Writes the representation to a XML writer. The default implementation calls SaxRepresentation.parse(ContentHandler) using the XmlWriter parameter as the content handler. This behavior is intended to be overridden.

Overrides:
write in class SaxRepresentation
Parameters:
writer - The XML writer to write to.
Throws:
IOException


Copyright © 2005-2013 Restlet.