org.apache.wicket.util.resource
Class XSLTResourceStream

java.lang.Object
  extended by org.apache.wicket.util.resource.AbstractResourceStream
      extended by org.apache.wicket.util.resource.XSLTResourceStream
All Implemented Interfaces:
java.io.Serializable, IClusterable, IResourceStream, IStringResourceStream, IModifiable

public class XSLTResourceStream
extends AbstractResourceStream

IResourceStream that applies XSLT on an input IResourceStream. The XSL stylesheet itself is also an IResourceStream. Override getParameters() to pass parameters to the XSL stylesheet.

FIXME experimental feature, does not implement any kind of caching, use with care, running an XSL transformation for every request is very expensive! Please have a look at ZipResourceStream for an in-depth explanation of what needs to be done with respect to caching.

Author:
Jean-Baptiste Quenot
See Also:
Serialized Form

Constructor Summary
XSLTResourceStream(IResourceStream xsltResource, IResourceStream xmlResource)
          Construct.
 
Method Summary
 void close()
          Closes the resource.
 java.lang.String getContentType()
          Returns always null
 java.io.InputStream getInputStream()
          Gets the resource stream.
protected  java.util.Map getParameters()
           
 Time lastModifiedTime()
          Returns always null
 long length()
          Gets the size of this resource in bytes TODO 1.5: rename to lengthInBytes() or let it return some sort of size object
 
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
asString, getCharset, getLocale, setCharset, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTResourceStream

public XSLTResourceStream(IResourceStream xsltResource,
                          IResourceStream xmlResource)
Construct.

Parameters:
xsltResource - the XSL stylesheet as an IResourceStream
xmlResource - the input XML document as an IResourceStream
Method Detail

getParameters

protected java.util.Map getParameters()
Returns:
a Map of XSLT parameters, appropriate for passing information to the XSL stylesheet

close

public void close()
           throws java.io.IOException
Description copied from interface: IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().

Throws:
java.io.IOException
See Also:
IResourceStream.close()

getContentType

public java.lang.String getContentType()
Returns always null

Specified by:
getContentType in interface IResourceStream
Overrides:
getContentType in class AbstractResourceStream
Returns:
The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestTarget handle the Content-Type automatically
See Also:
IResourceStream.getContentType()

getInputStream

public java.io.InputStream getInputStream()
                                   throws ResourceStreamNotFoundException
Description copied from interface: IResourceStream
Gets the resource stream. You should not directly close this stream. Instead call the close() method on IResourceStream.

Returns:
Returns the inputStream.
Throws:
ResourceStreamNotFoundException
See Also:
IResourceStream.getInputStream()

length

public long length()
Description copied from interface: IResourceStream
Gets the size of this resource in bytes TODO 1.5: rename to lengthInBytes() or let it return some sort of size object

Specified by:
length in interface IResourceStream
Overrides:
length in class AbstractResourceStream
Returns:
The size of this resource in the number of bytes, or -1 if unknown
See Also:
IResourceStream.length()

lastModifiedTime

public Time lastModifiedTime()
Returns always null

Specified by:
lastModifiedTime in interface IModifiable
Overrides:
lastModifiedTime in class AbstractResourceStream
Returns:
the last modification Time
See Also:
IModifiable.lastModifiedTime()


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.