org.apache.tapestry.web
Class ServletWebContext

java.lang.Object
  extended by org.apache.tapestry.web.ServletWebContext
All Implemented Interfaces:
Describable, AttributeHolder, InitializationParameterHolder, WebContext

public class ServletWebContext
extends java.lang.Object
implements WebContext

Adapts ServletContext as WebContext.

Since:
4.0
Author:
Howard M. Lewis Ship

Constructor Summary
ServletWebContext(javax.servlet.ServletContext context)
           
 
Method Summary
 void describeTo(DescriptionReceiver receiver)
          Invoked to have the receiver describe itself (largely in terms of properties and values).
 java.lang.Object getAttribute(java.lang.String name)
          Returns the named object, or null if no attribute has been stored with the given name.
 java.util.List getAttributeNames()
          Returns a list of all known attributes in ascending alphabetical order.
 java.util.List getInitParameterNames()
          Returns a sorted list of the names of all initialization parameters (which may be the empty list).
 java.lang.String getInitParameterValue(java.lang.String name)
          Returns the value of the named parameter, or null if the reciever does not have such a parameter.
 java.lang.String getMimeType(java.lang.String resourcePath)
          Returns the MIME type of the specified file, or null if the MIME type is not known.
 java.net.URL getResource(java.lang.String path)
          Returns a URL to the resource that is mapped to a specified path.
 void setAttribute(java.lang.String name, java.lang.Object attribute)
          Updates the attribute, replacing (or removing) its value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletWebContext

public ServletWebContext(javax.servlet.ServletContext context)
Method Detail

describeTo

public void describeTo(DescriptionReceiver receiver)
Description copied from interface: Describable
Invoked to have the receiver describe itself (largely in terms of properties and values). If the caller does not invoke any methods on the receiver, then the a default description of the caller will be used (based on toString().

Specified by:
describeTo in interface Describable

getAttributeNames

public java.util.List getAttributeNames()
Description copied from interface: AttributeHolder
Returns a list of all known attributes in ascending alphabetical order. May be empty (but won't be null).

Specified by:
getAttributeNames in interface AttributeHolder

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: AttributeHolder
Returns the named object, or null if no attribute has been stored with the given name.

Specified by:
getAttribute in interface AttributeHolder

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object attribute)
Description copied from interface: AttributeHolder
Updates the attribute, replacing (or removing) its value. For certain implementations, the attribute may need to be serializable (for example, a WebSession  attribute in a clustered application).

Specified by:
setAttribute in interface AttributeHolder
Parameters:
name - the name of the attribute to update
attribute - the new value for the attribute, or null to delete the attribute entirely.

getResource

public java.net.URL getResource(java.lang.String path)
Description copied from interface: WebContext
Returns a URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.

Specified by:
getResource in interface WebContext

getInitParameterValue

public java.lang.String getInitParameterValue(java.lang.String name)
Description copied from interface: InitializationParameterHolder
Returns the value of the named parameter, or null if the reciever does not have such a parameter.

Specified by:
getInitParameterValue in interface InitializationParameterHolder
Parameters:
name - the name of the parameter to retrieve
Returns:
the corresponding value, or null

getInitParameterNames

public java.util.List getInitParameterNames()
Description copied from interface: InitializationParameterHolder
Returns a sorted list of the names of all initialization parameters (which may be the empty list).

Specified by:
getInitParameterNames in interface InitializationParameterHolder
Returns:
List of String

getMimeType

public java.lang.String getMimeType(java.lang.String resourcePath)
Description copied from interface: WebContext
Returns the MIME type of the specified file, or null if the MIME type is not known.

Specified by:
getMimeType in interface WebContext