java.lang.Object
com.semanticcms.core.servlet.SemanticCMS
The SemanticCMS application context.
TODO: Consider custom EL resolver for this variable. http://stackoverflow.com/questions/5016965/how-to-add-a-custom-variableresolver-in-pure-jsp
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Exposes the application context as an application-scopeSemanticCMS
instance named "APPLICATION_ATTRIBUTE_NAME
".static interface
SemanticCMS.LinkCssClassResolver<E extends Element>
Resolves the link CSS class for the given types of elements.static interface
SemanticCMS.ListItemCssClassResolver<N extends Node>
Resolves the list item CSS class for the given types of nodes. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ScopeEE.Application.Attribute
<SemanticCMS> static final ScopeEE.Application.Attribute
<SemanticCMS> static final String
The default theme is used when no other theme is registered.static final String
The default view is the content view and will have the empty view name.static final String
The parameter name used for views. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(Component component) Registers a new component.void
addCssLink
(String cssLink) Deprecated, for removal: This API element is subject to removal in a future version.void
addHeadInclude
(String headInclude) Registers a new head include.<E extends Element>
voidaddLinkCssClass
(Class<E> elementType, String cssLinkClass) Registers a new CSS class to use in link to the given type of element.<E extends Element>
voidaddLinkCssClassResolver
(Class<E> elementType, SemanticCMS.LinkCssClassResolver<? super E> cssLinkClassResolver) Registers a new CSS resolver to use in link to the given type of element.<N extends Node>
voidaddListItemCssClass
(Class<N> nodeType, String listItemCssClass) Registers a new CSS class to use in list items to the given type of node.<N extends Node>
voidaddListItemCssClassResolver
(Class<N> nodeType, SemanticCMS.ListItemCssClassResolver<? super N> listItemCssClassResolver) Registers a new CSS resolver to use in list items to the given type of node.void
addPrintCssLink
(String printCssLink) Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.void
Registers a new script.void
Registers a new theme.void
Registers a new view.protected void
destroy()
Called when the context is shutting down.Gets the book for the provided context-relative servlet path ornull
if no book configured at that path.getBook
(HttpServletRequest request) Gets the book for the provided request ornull
if no book configured at the current request path.getBooks()
Gets all components in an undefined, but consistent (within a single run) ordering.Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.boolean
When true, a cursory attempt will be made to hide sensitive information for demo mode.A shared executor available to all components.Gets the head includes, in the order added.static SemanticCMS
getInstance
(ServletContext servletContext) Gets the SemanticCMS instance, creating it if necessary.getLinkCssClass
(E element) Gets the CSS class to use in links to the given element.getListItemCssClass
(N node) Gets the CSS class to use in list items to the given node.Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.Gets the root book as configured in /WEB-INF/books.propertiesGets the scripts, in the order added.Gets the themes, in the order added.Gets all view groups.getViews()
Gets the views, ordered by view group then display.Gets the views in order added.
-
Field Details
-
APPLICATION_ATTRIBUTE
-
APPLICATION_ATTRIBUTE_OLD
-
VIEW_PARAM
The parameter name used for views.- See Also:
-
DEFAULT_VIEW_NAME
The default view is the content view and will have the empty view name.- See Also:
-
DEFAULT_THEME_NAME
The default theme is used when no other theme is registered.- See Also:
-
-
Constructor Details
-
SemanticCMS
protected SemanticCMS(ServletContext servletContext) throws IOException, SAXException, ParserConfigurationException
-
-
Method Details
-
getInstance
Gets the SemanticCMS instance, creating it if necessary. -
destroy
protected void destroy()Called when the context is shutting down. -
getDemoMode
public boolean getDemoMode()When true, a cursory attempt will be made to hide sensitive information for demo mode. -
getBooks
-
getMissingBooks
-
getRootBook
Gets the root book as configured in /WEB-INF/books.properties -
getBook
Gets the book for the provided context-relative servlet path ornull
if no book configured at that path. The book with the longest prefix match is used. The servlet path must begin with a slash (/). -
getBook
Gets the book for the provided request ornull
if no book configured at the current request path. -
getViewGroups
Gets all view groups. -
getViewsByName
Gets the views in order added. -
getViews
Gets the views, ordered by view group then display.- See Also:
-
addView
Registers a new view.- Throws:
IllegalStateException
- if a view is already registered with the name.
-
getComponents
Gets all components in an undefined, but consistent (within a single run) ordering. -
addComponent
Registers a new component. -
getThemes
Gets the themes, in the order added. -
addTheme
Registers a new theme.- Throws:
IllegalStateException
- if a theme is already registered with the name.
-
getCssLinks
Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.Gets the CSS links, in the order added. -
addCssLink
Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.Registers a new CSS link.- Throws:
IllegalStateException
- if the link is already registered.
-
getPrintCssLinks
Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.Gets the print CSS links, in the order added. -
addPrintCssLink
@Deprecated(forRemoval=true) public void addPrintCssLink(String printCssLink) throws IllegalStateException Deprecated, for removal: This API element is subject to removal in a future version.Please useRegistryEE
directly.Registers a new print CSS link.- Throws:
IllegalStateException
- if the link is already registered.
-
getScripts
Gets the scripts, in the order added. -
addScript
Registers a new script. When a script is added multiple times, the src must be consistent between adds. Also, a src may not be added under different names.- Parameters:
name
- the name of the script, independent of version and srcsrc
- the src of the script.- Throws:
IllegalStateException
- if the script already registered but with a different src.
-
getHeadIncludes
Gets the head includes, in the order added. -
addHeadInclude
Registers a new head include.- Throws:
IllegalStateException
- if the link is already registered.
-
getLinkCssClass
Gets the CSS class to use in links to the given element. Also looks for match on parent classes up to and including Element itself.- Returns:
- The CSS class or
null
when element is null or no class registered for it or any super class. - See Also:
-
addLinkCssClassResolver
public <E extends Element> void addLinkCssClassResolver(Class<E> elementType, SemanticCMS.LinkCssClassResolver<? super E> cssLinkClassResolver) throws IllegalStateException Registers a new CSS resolver to use in link to the given type of element.- Throws:
IllegalStateException
- if the element type is already registered.
-
addLinkCssClass
public <E extends Element> void addLinkCssClass(Class<E> elementType, String cssLinkClass) throws IllegalStateException Registers a new CSS class to use in link to the given type of element.- Throws:
IllegalStateException
- if the element type is already registered.
-
getListItemCssClass
Gets the CSS class to use in list items to the given node. Also looks for match on parent classes up to and including Node itself.- Returns:
- The CSS class or
null
when node is null or no class registered for it or any super class. - See Also:
-
addListItemCssClassResolver
public <N extends Node> void addListItemCssClassResolver(Class<N> nodeType, SemanticCMS.ListItemCssClassResolver<? super N> listItemCssClassResolver) throws IllegalStateException Registers a new CSS resolver to use in list items to the given type of node.- Throws:
IllegalStateException
- if the node type is already registered.
-
addListItemCssClass
public <N extends Node> void addListItemCssClass(Class<N> nodeType, String listItemCssClass) throws IllegalStateException Registers a new CSS class to use in list items to the given type of node.- Throws:
IllegalStateException
- if the node type is already registered.
-
getExecutors
A shared executor available to all components.Consider selecting concurrent or sequential implementations based on overall system load. See
ConcurrencyCoordinator.isConcurrentProcessingRecommended(javax.servlet.ServletRequest)
.- See Also:
-
RegistryEE
directly.