Package org.apache.wicket.util.resource
Class XSLTResourceStream
- java.lang.Object
-
- org.apache.wicket.util.resource.AbstractResourceStream
-
- org.apache.wicket.util.resource.XSLTResourceStream
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,IClusterable
,IResourceStream
,IModifiable
public class XSLTResourceStream extends AbstractResourceStream
IResourceStream
that applies XSLT on an inputIResourceStream
. The XSL stylesheet itself is also anIResourceStream
. OverridegetParameters()
to pass parameters to the XSL stylesheet.NOTE: this is an experimental feature which 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
Constructors Constructor Description XSLTResourceStream(IResourceStream xsltResource, IResourceStream xmlResource)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the resource.String
getContentType()
Returns always nullInputStream
getInputStream()
Gets the resource stream.protected Map<Object,Object>
getParameters()
Instant
lastModifiedTime()
Returns always nullBytes
length()
Gets the size of this resource-
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
getLocale, getStyle, getVariation, setLocale, setStyle, setVariation
-
-
-
-
Constructor Detail
-
XSLTResourceStream
public XSLTResourceStream(IResourceStream xsltResource, IResourceStream xmlResource)
Construct.- Parameters:
xsltResource
- the XSL stylesheet as anIResourceStream
xmlResource
- the input XML document as anIResourceStream
-
-
Method Detail
-
getParameters
protected Map<Object,Object> getParameters()
- Returns:
- a
Map
of XSLT parameters, appropriate for passing information to the XSL stylesheet
-
close
public void close() throws IOException
Description copied from interface:IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().- Throws:
IOException
- See Also:
IResourceStream.close()
-
getContentType
public String getContentType()
Returns always null- Specified by:
getContentType
in interfaceIResourceStream
- Overrides:
getContentType
in classAbstractResourceStream
- Returns:
- The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestHandler handle the Content-Type automatically
- See Also:
IResourceStream.getContentType()
-
getInputStream
public 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 Bytes length()
Description copied from interface:IResourceStream
Gets the size of this resource- Specified by:
length
in interfaceIResourceStream
- Overrides:
length
in classAbstractResourceStream
- Returns:
- The size of this resource in the number of bytes, or
null
if unknown - See Also:
IResourceStream.length()
-
lastModifiedTime
public Instant lastModifiedTime()
Returns always null- Specified by:
lastModifiedTime
in interfaceIModifiable
- Overrides:
lastModifiedTime
in classAbstractResourceStream
- Returns:
- the last modification
Time
ornull
if that information is not available - See Also:
IModifiable.lastModifiedTime()
-
-