info.magnolia.cms.core
Class AggregationState

java.lang.Object
  extended by info.magnolia.cms.core.AggregationState

public class AggregationState
extends Object

Aggregates the necessary information to render content. Filled-in progressively by various filters.


Constructor Summary
AggregationState()
           
 
Method Summary
 Channel getChannel()
           
 String getCharacterEncoding()
           
 Content getCurrentContent()
          Deprecated. since 5.0 - use #getCurrentContentNode() instead.
 javax.jcr.Node getCurrentContentNode()
           
 String getCurrentURI()
           
 String getExtension()
           
 File getFile()
           
 String getHandle()
           
 Locale getLocale()
          If the aggregation state local is not set explicitly the contexts locale is returned.
 Content getMainContent()
          Deprecated. since 5.0 - use #getMainContentNode() instead.
 javax.jcr.Node getMainContentNode()
           
 String getOriginalBrowserURI()
           
 String getOriginalBrowserURL()
           
 String getOriginalURI()
          Returns the original request URI, decoded and without the context path.
 String getOriginalURL()
           
 String getQueryString()
          Returns the original request query string.
 String getRepository()
           
 String getSelector()
          A selector is the part between the first Path.SELECTOR_DELIMITER and the extension of an URI.
 String[] getSelectors()
           
 String getTemplateName()
           
 boolean isPreviewMode()
           
 void resetURIs()
          The original URI/URL can only be set once.
 void setChannel(Channel channel)
           
 void setCharacterEncoding(String characterEncoding)
           
 void setCurrentContent(Content currentContent)
          Deprecated. since 5.0 - use #setCurrentContentNode(Node) instead.
 void setCurrentContentNode(javax.jcr.Node currentContentNode)
           
 void setCurrentURI(String currentURI)
           
 void setExtension(String extension)
           
 void setFile(File file)
           
 void setHandle(String handle)
           
 void setLocale(Locale locale)
           
 void setMainContent(Content mainContent)
          Deprecated. since 5.0 - use #setMainContentNode(Node) instead.
 void setMainContentNode(javax.jcr.Node mainContentNode)
           
 void setOriginalBrowserURI(String originalBrowserURI)
           
 void setOriginalBrowserURL(String originalBrowserURL)
           
 void setOriginalURI(String originalURI)
           
 void setOriginalURL(String originalURL)
           
 void setPreviewMode(boolean previewMode)
           
 void setQueryString(String queryString)
           
 void setRepository(String repository)
           
 void setSelector(String selector)
          Warning - this might change in the future - see MAGNOLIA-2343 for details. The provided selector value is decoded upon settings according to rules described in URLDecoder.decode(java.lang.String, java.lang.String)
 void setTemplateName(String templateName)
           
protected  String stripContextPathIfExists(String uri)
          WARNING: If passing URI without context path but it starts with same text as the context path it will be stripped off as well!!!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregationState

public AggregationState()
Method Detail

setOriginalURI

public void setOriginalURI(String originalURI)

setOriginalBrowserURI

public void setOriginalBrowserURI(String originalBrowserURI)

setCurrentURI

public void setCurrentURI(String currentURI)

setQueryString

public void setQueryString(String queryString)

getQueryString

public String getQueryString()
Returns the original request query string.


getCurrentURI

public String getCurrentURI()
Returns:
the URI of the current request, decoded and without the context path. This URI might have been modified by various filters.

getCharacterEncoding

public String getCharacterEncoding()

getOriginalURI

public String getOriginalURI()
Returns the original request URI, decoded and without the context path. Can never be modified.


getOriginalURL

public String getOriginalURL()

setOriginalURL

public void setOriginalURL(String originalURL)

getOriginalBrowserURI

public String getOriginalBrowserURI()

getOriginalBrowserURL

public String getOriginalBrowserURL()

setOriginalBrowserURL

public void setOriginalBrowserURL(String originalBrowserURL)

setCharacterEncoding

public void setCharacterEncoding(String characterEncoding)

getExtension

public String getExtension()

setExtension

public void setExtension(String extension)

getFile

public File getFile()

setFile

public void setFile(File file)

getHandle

public String getHandle()

setHandle

public void setHandle(String handle)

getMainContentNode

public javax.jcr.Node getMainContentNode()

getMainContent

public Content getMainContent()
Deprecated. since 5.0 - use #getMainContentNode() instead.


setMainContentNode

public void setMainContentNode(javax.jcr.Node mainContentNode)

setMainContent

public void setMainContent(Content mainContent)
Deprecated. since 5.0 - use #setMainContentNode(Node) instead.


getCurrentContentNode

public javax.jcr.Node getCurrentContentNode()

getCurrentContent

public Content getCurrentContent()
Deprecated. since 5.0 - use #getCurrentContentNode() instead.


setCurrentContentNode

public void setCurrentContentNode(javax.jcr.Node currentContentNode)

setCurrentContent

public void setCurrentContent(Content currentContent)
Deprecated. since 5.0 - use #setCurrentContentNode(Node) instead.


getRepository

public String getRepository()

setRepository

public void setRepository(String repository)

getSelector

public String getSelector()
A selector is the part between the first Path.SELECTOR_DELIMITER and the extension of an URI. I.e. given a URI like http://myserver/mypage~x~foo=bar~.html the entire selector is ~x~foo=bar~. A selector can be split in turn into several selectors separated from each other by the Path.SELECTOR_DELIMITER. In the above example, single selectors are x and foo=bar. The latter is a name=value selector which is set in the MgnlContext as an attribute with scope Context.LOCAL_SCOPE. You can retrieve its value via MgnlContext.getAttribute("foo").

You can get and iterate over a full selector with the getSelectors() method.

Warning - this might change in the future - see MAGNOLIA-2343 for details.


setSelector

public void setSelector(String selector)
Warning - this might change in the future - see MAGNOLIA-2343 for details. The provided selector value is decoded upon settings according to rules described in URLDecoder.decode(java.lang.String, java.lang.String)


getTemplateName

public String getTemplateName()

setTemplateName

public void setTemplateName(String templateName)

getLocale

public Locale getLocale()
If the aggregation state local is not set explicitly the contexts locale is returned.

Returns:
The aggregation state level locale, i.e. the locale that should be used for contents

setLocale

public void setLocale(Locale locale)
Parameters:
locale - The aggregation state level locale, i.e. the locale that should be used for contents

isPreviewMode

public boolean isPreviewMode()

setPreviewMode

public void setPreviewMode(boolean previewMode)

getChannel

public Channel getChannel()

setChannel

public void setChannel(Channel channel)

stripContextPathIfExists

protected String stripContextPathIfExists(String uri)
WARNING: If passing URI without context path but it starts with same text as the context path it will be stripped off as well!!!

Parameters:
uri - with contextPath (maybe)
Returns:
uri stripped of the prefix matching the contextPath

resetURIs

public void resetURIs()
The original URI/URL can only be set once. A call to this methods resets the original URI/URL and allows to set them freshly.


getSelectors

public String[] getSelectors()
Returns:
an array containing the selectors found in the URI. The array is empty if no selector is in the current aggregation state. Given a URI like this http://www.magnolia-cms.com/node~value1~value2~.html?someparam=booo, the entire selector is ~value1~value2~, whereas the single selectors are value1 and value2. Selectors are delimited by Path.SELECTOR_DELIMITER.

Warning - this might change in the future - see MAGNOLIA-2343 for details.



Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.