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:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMarkupResourceStream
(IResourceStream resourceStream) Construct.MarkupResourceStream
(IResourceStream resourceStream, ContainerInfo containerInfo, Class<?> markupClass) Construct. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the resource.In case of markup inheritance, the base markup resource.Get the resource stream containing the base markup (markup inheritance)final String
Gets cacheKey.Get the container info associated with the markupGets the mime type of this resourcefinal String
Gets doctype.Gets the markup encoding.Gets the resource stream.Get the actual component class the markup is directly associated with.Gets the resource that contains this markupgetStyle()
final String
Get the wicket namespace valid for this specific markupboolean
isHtml5()
Gets the last time this modifiable thing changed.length()
Gets the size of this resourcevoid
setBaseMarkup
(Markup baseMarkup) In case of markup inheritance, the base markup.final void
setCacheKey
(String cacheKey) Set the cache keyfinal void
setDoctype
(CharSequence doctype) Sets doctype.void
This method shouldn't be used from the outside.void
This method shouldn't be used from the outside.void
setVariation
(String variation) This method shouldn't be used from the outside.final void
setWicketNamespace
(String wicketNamespace) Sets wicketNamespace.toString()
-
Field Details
-
WICKET_XHTML_DTD
- See Also:
-
-
Constructor Details
-
MarkupResourceStream
Construct.- Parameters:
resourceStream
-
-
MarkupResourceStream
public MarkupResourceStream(IResourceStream resourceStream, ContainerInfo containerInfo, Class<?> markupClass) Construct.- Parameters:
resourceStream
-containerInfo
-markupClass
-
-
-
Method Details
-
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
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
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
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:
-
getLocale
- Specified by:
getLocale
in interfaceIResourceStream
- Returns:
- The Locale where this stream did resolve to
-
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
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
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
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
Get the container info associated with the markup- Returns:
- ContainerInfo
-
getCacheKey
Gets cacheKey.- Returns:
- cacheKey
-
setCacheKey
Set the cache key- Parameters:
cacheKey
-
-
getResource
Gets the resource that contains this markup- Returns:
- The resource where this markup came from
-
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
Get the wicket namespace valid for this specific markup- Returns:
- wicket namespace
-
getWicketId
- Returns:
- usually it is "wicket:id"
-
setWicketNamespace
Sets wicketNamespace.- Parameters:
wicketNamespace
- wicketNamespace
-
getBaseMarkupResourceStream
Get the resource stream containing the base markup (markup inheritance)- Returns:
- baseMarkupResource Null, if not base markup
-
setBaseMarkup
In case of markup inheritance, the base markup.- Parameters:
baseMarkup
- The base markup
-
getBaseMarkup
In case of markup inheritance, the base markup resource.- Returns:
- The base markup
-
getStyle
- Specified by:
getStyle
in interfaceIResourceStream
- Returns:
- The Style where this stream did resolve to
-
getVariation
- Specified by:
getVariation
in interfaceIResourceStream
- Returns:
- The Variation where this stream did resolve to
-
setStyle
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
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.
-
toString
-
getDoctype
Gets doctype.- Returns:
- The doctype excluding 'DOCTYPE'
-
setDoctype
Sets doctype.- Parameters:
doctype
- doctype
-
isHtml5
- Returns:
- True, if doctype == <!DOCTYPE html>
- See Also:
-