org.wings.resource
Class ClassPathStylesheetResource

java.lang.Object
  extended by org.wings.Resource
      extended by org.wings.StaticResource
          extended by org.wings.resource.ClassPathResource
              extended by org.wings.resource.ClassPathStylesheetResource
All Implemented Interfaces:
Serializable, Renderable, NamedResource, URLResource

public class ClassPathStylesheetResource
extends ClassPathResource

A ClassPathStylesheetResource is a static resource whose content is read from a classloader. It is special for its handling of occurences of "url([classPath])" strings. These are read from classPath and externalized.

Version:
$$
Author:
ole
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.wings.StaticResource
StaticResource.LimitedBuffer
 
Nested classes/interfaces inherited from class org.wings.Resource
Resource.HeaderEntry
 
Field Summary
 
Fields inherited from class org.wings.resource.ClassPathResource
resourceFileName
 
Fields inherited from class org.wings.StaticResource
buffer, externalizerFlags, maxBufferSize, size
 
Fields inherited from class org.wings.Resource
extension, headers, id, mimeType
 
Constructor Summary
ClassPathStylesheetResource(ClassLoader classLoader, String resourceFileName)
          A static css resource that is obtained from the specified class loader
ClassPathStylesheetResource(ClassLoader classLoader, String resourceFileName, String mimeType)
          A static css resource that is obtained from the specified class loader
ClassPathStylesheetResource(ClassLoader classLoader, String resourceFileName, String mimeType, int maxBufferSize)
          A static css resource that is obtained from the specified class loader
ClassPathStylesheetResource(String resourceFileName)
          A static css resource that is obtained from the default classpath.
ClassPathStylesheetResource(String resourceFileName, String mimeType)
          A static css resource that is obtained from the default classpath.
 
Method Summary
protected  StaticResource.LimitedBuffer bufferResource()
          Reads the resource into an LimitedBuffer and returns it.
 boolean equals(Object o)
          Two ClassPathStylesheetResource are equal if both of them are instances of ClassPathStylesheetResource and the equals method of ClassPathResource is true.
protected  InputStream getResourceStream()
           
 int hashCode()
          Simple hascode implementation
 
Methods inherited from class org.wings.resource.ClassPathResource
getClassLoader, getResourceName
 
Methods inherited from class org.wings.StaticResource
getExternalizerFlags, getId, getLength, getMaxBufferSize, getURL, resolveName, setExternalizerFlags, setMaxBufferSize, setMimeType, toString, write
 
Methods inherited from class org.wings.Resource
getExtension, getHeaders, getMimeType, getSession, setHeaders
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassPathStylesheetResource

public ClassPathStylesheetResource(String resourceFileName)
A static css resource that is obtained from the default classpath.


ClassPathStylesheetResource

public ClassPathStylesheetResource(String resourceFileName,
                                   String mimeType)
A static css resource that is obtained from the default classpath.


ClassPathStylesheetResource

public ClassPathStylesheetResource(ClassLoader classLoader,
                                   String resourceFileName)
A static css resource that is obtained from the specified class loader

Parameters:
classLoader - the classLoader from which the resource is obtained
resourceFileName - the css resource relative to the baseClass

ClassPathStylesheetResource

public ClassPathStylesheetResource(ClassLoader classLoader,
                                   String resourceFileName,
                                   String mimeType)
A static css resource that is obtained from the specified class loader

Parameters:
classLoader - the classLoader from which the resource is obtained
resourceFileName - the css resource relative to the baseClass
mimeType - the mimetype of the resource

ClassPathStylesheetResource

public ClassPathStylesheetResource(ClassLoader classLoader,
                                   String resourceFileName,
                                   String mimeType,
                                   int maxBufferSize)
A static css resource that is obtained from the specified class loader

Parameters:
classLoader - the classLoader from which the resource is obtained
resourceFileName - the css resource relative to the baseClass
mimeType - the mimetype of the resource
maxBufferSize - the maximum buffer size for the style sheet. If big enough, stylesheet is cached, else parsed again.
Method Detail

getResourceStream

protected final InputStream getResourceStream()
                                       throws ResourceNotFoundException
Overrides:
getResourceStream in class ClassPathResource
Throws:
ResourceNotFoundException

equals

public boolean equals(Object o)
Two ClassPathStylesheetResource are equal if both of them are instances of ClassPathStylesheetResource and the equals method of ClassPathResource is true.

Overrides:
equals in class ClassPathResource
Returns:
true if the two instances are equal.

hashCode

public int hashCode()
Simple hascode implementation

Overrides:
hashCode in class ClassPathResource
Returns:
a hashcode, comprised from the hashcodes of the classloader and from the file name of the resource.

bufferResource

protected StaticResource.LimitedBuffer bufferResource()
                                               throws IOException,
                                                      ResourceNotFoundException
Description copied from class: StaticResource
Reads the resource into an LimitedBuffer and returns it. If the size of the resource is larger than StaticResource.LimitedBuffer.MAX_SIZE_TO_BUFFER, then the returned Buffer is empty and does not contain the Resource's content (and the isValid() flag is false).

Overrides:
bufferResource in class StaticResource
Returns:
buffered resource as LimitedBuffer, that may be invalid, if the size of the resource is beyond MAX_SIZE_TO_BUFFER. It is null, if the Resource returned an invalid stream.
Throws:
IOException
ResourceNotFoundException


wingS Swings ;-)