Package org.apache.wicket.markup
Class MarkupResourceStream
- java.lang.Object
-
- org.apache.wicket.markup.MarkupResourceStream
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,IClusterable
,IFixedLocationResourceStream
,IResourceStream
,IModifiable
public class MarkupResourceStream extends Object implements IResourceStream, IFixedLocationResourceStream
An IResourceStream implementation with specific extensions for markup resource streams.- Author:
- Juergen Donnerstag
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
WICKET_XHTML_DTD
-
Constructor Summary
Constructors Constructor Description MarkupResourceStream(IResourceStream resourceStream)
Construct.MarkupResourceStream(IResourceStream resourceStream, ContainerInfo containerInfo, Class<?> markupClass)
Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the resource.Markup
getBaseMarkup()
In case of markup inheritance, the base markup resource.MarkupResourceStream
getBaseMarkupResourceStream()
Get the resource stream containing the base markup (markup inheritance)String
getCacheKey()
Gets cacheKey.ContainerInfo
getContainerInfo()
Get the container info associated with the markupString
getContentType()
Gets the mime type of this resourceString
getDoctype()
Gets doctype.String
getEncoding()
Gets the markup encoding.InputStream
getInputStream()
Gets the resource stream.Locale
getLocale()
Class<? extends Component>
getMarkupClass()
Get the actual component class the markup is directly associated with.IResourceStream
getResource()
Gets the resource that contains this markupString
getStyle()
String
getVariation()
String
getWicketId()
String
getWicketNamespace()
Get the wicket namespace valid for this specific markupboolean
isHtml5()
Instant
lastModifiedTime()
Gets the last time this modifiable thing changed.Bytes
length()
Gets the size of this resourceString
locationAsString()
void
setBaseMarkup(Markup baseMarkup)
In case of markup inheritance, the base markup.void
setCacheKey(String cacheKey)
Set the cache keyvoid
setDoctype(CharSequence doctype)
Sets doctype.void
setLocale(Locale locale)
This method shouldn't be used from the outside.void
setStyle(String style)
This method shouldn't be used from the outside.void
setVariation(String variation)
This method shouldn't be used from the outside.void
setWicketNamespace(String wicketNamespace)
Sets wicketNamespace.String
toString()
-
-
-
Field Detail
-
WICKET_XHTML_DTD
public static final String WICKET_XHTML_DTD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MarkupResourceStream
public MarkupResourceStream(IResourceStream resourceStream)
Construct.- Parameters:
resourceStream
-
-
MarkupResourceStream
public MarkupResourceStream(IResourceStream resourceStream, ContainerInfo containerInfo, Class<?> markupClass)
Construct.- Parameters:
resourceStream
-containerInfo
-markupClass
-
-
-
Method Detail
-
locationAsString
public String locationAsString()
- Specified by:
locationAsString
in interfaceIFixedLocationResourceStream
- Returns:
- The fixed location as a string, e.g. the file name or the URL. Return null to avoid caching the markup.
-
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().- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceIResourceStream
- Throws:
IOException
-
getContentType
public String getContentType()
Description copied from interface:IResourceStream
Gets the mime type of this resource- Specified by:
getContentType
in interfaceIResourceStream
- Returns:
- The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestHandler handle the Content-Type automatically
-
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.- Specified by:
getInputStream
in interfaceIResourceStream
- Returns:
- Returns the inputStream.
- Throws:
ResourceStreamNotFoundException
- See Also:
IResourceStream.close()
-
getLocale
public Locale getLocale()
- Specified by:
getLocale
in interfaceIResourceStream
- Returns:
- The Locale where this stream did resolve to
-
lastModifiedTime
public Instant lastModifiedTime()
Description copied from interface:IModifiable
Gets the last time this modifiable thing changed.- Specified by:
lastModifiedTime
in interfaceIModifiable
- Returns:
- the last modification
Time
ornull
if that information is not available
-
length
public Bytes length()
Description copied from interface:IResourceStream
Gets the size of this resource- Specified by:
length
in interfaceIResourceStream
- Returns:
- The size of this resource in the number of bytes, or
null
if unknown
-
setLocale
public void setLocale(Locale locale)
Description copied from interface:IResourceStream
This method shouldn't be used from the outside. It is used by the Loaders to set the resolved locale.- Specified by:
setLocale
in interfaceIResourceStream
- Parameters:
locale
- The Locale where this stream did resolve to.
-
getMarkupClass
public Class<? extends Component> getMarkupClass()
Get the actual component class the markup is directly associated with. Note: it not necessarily must be the container class.- Returns:
- The directly associated class
-
getContainerInfo
public ContainerInfo getContainerInfo()
Get the container info associated with the markup- Returns:
- ContainerInfo
-
getCacheKey
public final String getCacheKey()
Gets cacheKey.- Returns:
- cacheKey
-
setCacheKey
public final void setCacheKey(String cacheKey)
Set the cache key- Parameters:
cacheKey
-
-
getResource
public IResourceStream getResource()
Gets the resource that contains this markup- Returns:
- The resource where this markup came from
-
getEncoding
public String getEncoding()
Gets the markup encoding. A markup encoding may be specified in a markup file with an XML encoding specifier of the form <?xml ... encoding="..." ?>.- Returns:
- Encoding, or null if not found.
-
getWicketNamespace
public String getWicketNamespace()
Get the wicket namespace valid for this specific markup- Returns:
- wicket namespace
-
getWicketId
public final String getWicketId()
- Returns:
- usually it is "wicket:id"
-
setWicketNamespace
public final void setWicketNamespace(String wicketNamespace)
Sets wicketNamespace.- Parameters:
wicketNamespace
- wicketNamespace
-
getBaseMarkupResourceStream
public MarkupResourceStream getBaseMarkupResourceStream()
Get the resource stream containing the base markup (markup inheritance)- Returns:
- baseMarkupResource Null, if not base markup
-
setBaseMarkup
public void setBaseMarkup(Markup baseMarkup)
In case of markup inheritance, the base markup.- Parameters:
baseMarkup
- The base markup
-
getBaseMarkup
public Markup getBaseMarkup()
In case of markup inheritance, the base markup resource.- Returns:
- The base markup
-
getStyle
public String getStyle()
- Specified by:
getStyle
in interfaceIResourceStream
- Returns:
- The Style where this stream did resolve to
-
getVariation
public String getVariation()
- Specified by:
getVariation
in interfaceIResourceStream
- Returns:
- The Variation where this stream did resolve to
-
setStyle
public void setStyle(String style)
Description copied from interface:IResourceStream
This method shouldn't be used from the outside. It is used by the Loaders to set the resolved Style.- Specified by:
setStyle
in interfaceIResourceStream
- Parameters:
style
- The style where this stream did resolve to.
-
setVariation
public void setVariation(String variation)
Description copied from interface:IResourceStream
This method shouldn't be used from the outside. It is used by the Loaders to set the resolved variation.- Specified by:
setVariation
in interfaceIResourceStream
- Parameters:
variation
- The Variation where this stream did resolve to.
-
getDoctype
public final String getDoctype()
Gets doctype.- Returns:
- The doctype excluding 'DOCTYPE'
-
setDoctype
public final void setDoctype(CharSequence doctype)
Sets doctype.- Parameters:
doctype
- doctype
-
-