org.apache.wicket.markup
Class MarkupResourceStream

java.lang.Object
  extended by org.apache.wicket.markup.MarkupResourceStream
All Implemented Interfaces:
java.io.Closeable, java.io.Serializable, IClusterable, IFixedLocationResourceStream, IResourceStream, IModifiable

public class MarkupResourceStream
extends java.lang.Object
implements IResourceStream, IFixedLocationResourceStream

An IResourceStream implementation with specific extensions for markup resource streams.

Author:
Juergen Donnerstag
See Also:
Serialized Form

Field Summary
static java.lang.String WICKET_XHTML_DTD
           
 
Constructor Summary
MarkupResourceStream(IResourceStream resourceStream)
          Construct.
MarkupResourceStream(IResourceStream resourceStream, ContainerInfo containerInfo, java.lang.Class<?> markupClass)
          Construct.
 
Method Summary
 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)
 java.lang.String getCacheKey()
          Gets cacheKey.
 ContainerInfo getContainerInfo()
          Get the container info associated with the markup
 java.lang.String getContentType()
          Gets the mime type of this resource
 java.lang.String getDoctype()
          Gets doctype.
 java.lang.String getEncoding()
          Gets the markup encoding.
 java.io.InputStream getInputStream()
          Gets the resource stream.
 java.util.Locale getLocale()
           
 java.lang.Class<? extends Component> getMarkupClass()
          Get the actual component class the markup is directly associated with.
 IResourceStream getResource()
          Gets the resource that contains this markup
 java.lang.String getStyle()
           
 java.lang.String getVariation()
           
 java.lang.String getWicketId()
           
 java.lang.String getWicketNamespace()
          Get the wicket namespace valid for this specific markup
 boolean isHtml5()
           
 Time lastModifiedTime()
          Gets the last time this modifiable thing changed.
 Bytes length()
          Gets the size of this resource
 java.lang.String locationAsString()
           
 void setBaseMarkup(Markup baseMarkup)
          In case of markup inheritance, the base markup.
 void setCacheKey(java.lang.String cacheKey)
          Set the cache key
 void setDoctype(java.lang.CharSequence doctype)
          Sets doctype.
 void setLocale(java.util.Locale locale)
          This method shouldn't be used from the outside.
 void setStyle(java.lang.String style)
          This method shouldn't be used from the outside.
 void setVariation(java.lang.String variation)
          This method shouldn't be used from the outside.
 void setWicketNamespace(java.lang.String wicketNamespace)
          Sets wicketNamespace.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WICKET_XHTML_DTD

public static final java.lang.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,
                            java.lang.Class<?> markupClass)
Construct.

Parameters:
resourceStream -
containerInfo -
markupClass -
Method Detail

locationAsString

public java.lang.String locationAsString()
Specified by:
locationAsString in interface IFixedLocationResourceStream
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 java.io.IOException
Description copied from interface: IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface IResourceStream
Throws:
java.io.IOException

getContentType

public java.lang.String getContentType()
Description copied from interface: IResourceStream
Gets the mime type of this resource

Specified by:
getContentType in interface IResourceStream
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:
WebResponse#detectContentType(org.apache.wicket.RequestCycle, String)

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.

Specified by:
getInputStream in interface IResourceStream
Returns:
Returns the inputStream.
Throws:
ResourceStreamNotFoundException
See Also:
IResourceStream.close()

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface IResourceStream
Returns:
The Locale where this stream did resolve to

lastModifiedTime

public Time lastModifiedTime()
Description copied from interface: IModifiable
Gets the last time this modifiable thing changed.

Specified by:
lastModifiedTime in interface IModifiable
Returns:
the last modification Time or null 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 interface IResourceStream
Returns:
The size of this resource in the number of bytes, or null if unknown

setLocale

public void setLocale(java.util.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 interface IResourceStream
Parameters:
locale - The Locale where this stream did resolve to.

getMarkupClass

public java.lang.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 java.lang.String getCacheKey()
Gets cacheKey.

Returns:
cacheKey

setCacheKey

public final void setCacheKey(java.lang.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 java.lang.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 java.lang.String getWicketNamespace()
Get the wicket namespace valid for this specific markup

Returns:
wicket namespace

getWicketId

public final java.lang.String getWicketId()
Returns:
usually it is "wicket:id"

setWicketNamespace

public final void setWicketNamespace(java.lang.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 java.lang.String getStyle()
Specified by:
getStyle in interface IResourceStream
Returns:
The Style where this stream did resolve to

getVariation

public java.lang.String getVariation()
Specified by:
getVariation in interface IResourceStream
Returns:
The Variation where this stream did resolve to

setStyle

public void setStyle(java.lang.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 interface IResourceStream
Parameters:
style - The style where this stream did resolve to.

setVariation

public void setVariation(java.lang.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 interface IResourceStream
Parameters:
variation - The Variation where this stream did resolve to.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDoctype

public final java.lang.String getDoctype()
Gets doctype.

Returns:
The doctype excluding 'DOCTYPE'

setDoctype

public final void setDoctype(java.lang.CharSequence doctype)
Sets doctype.

Parameters:
doctype - doctype

isHtml5

public boolean isHtml5()
Returns:
True, if doctype == <!DOCTYPE html>
See Also:
http://www.w3.org/TR/html5-diff/#doctype


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.