protected static class AbstractAssembler.AssemblyContext extends Object implements Definition
Definition object. It also provides a storage location for context parameters for use while assembling the definition into a URI. This object also implements the Definition interface. The default implementation is simply a thin wrapper over the input Definition object. Overriding classes, however, will likely need to extend this class so that they can include context parameters for specific parameters that the assembler needs. For example, if the pagename parameter is extracted from the definition then altered or split for inclusion in the URI, it may be helpful to store the derived value in the context so that it can be subsequently retrieved in each of the main worker methods (AbstractAssembler.getScheme(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getAuthority(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getPath(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getQuery(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), and AbstractAssembler.getFragment(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext) without having to re-parse the definition each time. In addition, it may be helpful to simply override the methods that implement the Definition interface so that certain parameters can be intercepted and changed. For instance, to suppress rendermode in the url it might be helpful to override AbstractAssembler.AssemblyContext.getParameterNames(), to never include rendermode, and to override AbstractAssembler.AssemblyContext.getParameter(java.lang.String), and AbstractAssembler.AssemblyContext.getParameters(java.lang.String) so that when rendermode is passed, null is always returned. Similar techniques can be applied to other parameters as well.Definition.AppType, Definition.ContainerType, Definition.SatelliteContextLOG_NAME| Modifier | Constructor and Description |
|---|---|
protected |
AssemblyContext(Definition def)
Construct the simplest possible assembly context that wraps the input definition.
|
| Modifier and Type | Method and Description |
|---|---|
Definition.AppType |
getAppType()
Get the app type.
|
Collection |
getAttrbuteNames()
Returns the keys of all the attributes.
|
Object |
getAttribute(String name)
Return an attribute with the given key.
|
String |
getAuthority()
Get the authority.
|
Definition.ContainerType |
getContainerType()
Get the container type.
|
Object |
getContextParameter(Object key)
Method to return arbitrary context parameters for use by overriding classes during the assembly operations.
|
String |
getFragment()
Get the uri fragment.
|
protected Definition |
getOriginalDefinition()
Method to return the original input definition object.
|
String |
getParameter(String name)
Get the specified parameter.
|
Collection |
getParameterNames()
Get the specified parameter names.
|
String[] |
getParameters(String name)
Get the specified parameters.
|
Definition.SatelliteContext |
getSatelliteContext()
Get the satellite context.
|
String |
getScheme()
Get the scheme.
|
boolean |
sessionEncode()
Get session encode switch
|
protected AssemblyContext(Definition def)
def - input definitionpublic String getScheme()
getScheme in interface DefinitionURI.getScheme()public String getAuthority()
getAuthority in interface DefinitionURI.getAuthority()public Definition.ContainerType getContainerType()
getContainerType in interface Definitionpublic Definition.AppType getAppType()
getAppType in interface Definitionpublic String getParameter(String name)
getParameter in interface Definitionname - parameter namepublic String[] getParameters(String name)
getParameters in interface Definitionname - parameter namepublic Collection getParameterNames()
getParameterNames in interface Definitionpublic String getFragment()
getFragment in interface Definitionpublic Object getAttribute(String name)
DefinitiongetAttribute in interface Definitionname - attribute keypublic Collection getAttrbuteNames()
DefinitiongetAttrbuteNames in interface Definitionpublic boolean sessionEncode()
sessionEncode in interface Definitionpublic Definition.SatelliteContext getSatelliteContext()
getSatelliteContext in interface Definitionprotected final Definition getOriginalDefinition()
AbstractAssembler class.