com.atlassian.confluence.renderer
Class PageContext

java.lang.Object
  extended by com.atlassian.renderer.RenderContext
      extended by com.atlassian.confluence.renderer.PageContext
All Implemented Interfaces:
com.atlassian.renderer.links.LinkContext, com.atlassian.renderer.RenderContextOutputType

public class PageContext
extends com.atlassian.renderer.RenderContext
implements com.atlassian.renderer.links.LinkContext

Context object that gets passed to the renderer to tell it what circumstances the page is being rendered in. This is used for all rendering in Confluence, not just rendering pages.


Field Summary
 
Fields inherited from interface com.atlassian.renderer.RenderContextOutputType
DISPLAY, EMAIL, FEED, HTML_EXPORT, PDF, PREVIEW, WORD
 
Constructor Summary
PageContext()
           
PageContext(ContentEntityObject entity)
           
PageContext(ContentEntityObject entity, PageContext previousContext)
          Deprecated. the ability to have an original context is likely to be removed in a future version
PageContext(java.lang.String spaceKey)
           
 
Method Summary
static PageContext contextWithTimeout(ContentEntityObject entity, com.atlassian.util.concurrent.Timeout timeout)
          Construct a new PageContext for the rendering of some entity within a given time.
static com.atlassian.util.concurrent.Timeout createMinimumTimeout()
          Returns a timeout of 1 hour.
 boolean equals(java.lang.Object o)
           
 ElementIdCreator getElementIdCreator()
           
 ContentEntityObject getEntity()
           
 PageContext getOriginalContext()
           
 java.lang.String getOutputDeviceType()
          Note, that if you want your code to be compatible with versions of Confluence older then 4.3.3 then you can instead call RenderContext.getParam(Object) with the parameter "output-device-type".
 java.lang.String getPageTitle()
           
 java.util.Calendar getPostingDay()
           
 java.lang.String getSpaceKey()
           
 com.atlassian.util.concurrent.Timeout getTimeout()
           
 int hashCode()
           
 void setOutputDeviceType(java.lang.String type)
          Set the output device type to be rendered for.
 
Methods inherited from class com.atlassian.renderer.RenderContext
addExternalReference, addParam, addRenderedContent, addRenderedContent, getAttachmentsPath, getBaseUrl, getCharacterEncoding, getEmbeddedResourceRenderer, getExternalReferences, getImagePath, getLinkRenderer, getOutputType, getParam, getParams, getRenderedContentStore, getRenderMode, getSiteRoot, isRenderingForWysiwyg, popRenderMode, pushRenderMode, setAttachmentsPath, setBaseUrl, setCharacterEncoding, setEmbeddedResourceRenderer, setImagePath, setLinkRenderer, setOutputType, setRenderingForWysiwyg, setSiteRoot
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageContext

public PageContext()

PageContext

public PageContext(java.lang.String spaceKey)

PageContext

public PageContext(ContentEntityObject entity)

PageContext

@Deprecated
public PageContext(ContentEntityObject entity,
                              PageContext previousContext)
Deprecated. the ability to have an original context is likely to be removed in a future version

Constructs a PageContext wrapping another pageContext. Uses the original PageContext's Timeout and RenderedContentStore. Deprecated as of 4.3. See https://jira.atlassian.com/browse/CONF-25663

Method Detail

contextWithTimeout

public static PageContext contextWithTimeout(ContentEntityObject entity,
                                             com.atlassian.util.concurrent.Timeout timeout)
Construct a new PageContext for the rendering of some entity within a given time.


createMinimumTimeout

public static com.atlassian.util.concurrent.Timeout createMinimumTimeout()
Returns a timeout of 1 hour. No conversion or rendering should ever take anything approaching that length.


getTimeout

public com.atlassian.util.concurrent.Timeout getTimeout()
Returns:
a timeout object indicating whether rendering has exceeded its allotted time.

getOutputDeviceType

public java.lang.String getOutputDeviceType()
Note, that if you want your code to be compatible with versions of Confluence older then 4.3.3 then you can instead call RenderContext.getParam(Object) with the parameter "output-device-type". For example, if you are a plugin developer writing a macro that can target different device types such as mobile, you can retain a common code base for your mobile and non-mobile implementations by avoiding this method and calling
getParam("output-device-type")
instead.

Returns:
the output device type. Typically this would be ConversionContextOutputDeviceType.DESKTOP but plugins that have their own renderer could use other types
Since:
4.3.3

setOutputDeviceType

public void setOutputDeviceType(java.lang.String type)
Set the output device type to be rendered for.

Parameters:
type - the type
Since:
4.3.3

getOriginalContext

public PageContext getOriginalContext()

getSpaceKey

public java.lang.String getSpaceKey()

getPageTitle

public java.lang.String getPageTitle()

getPostingDay

public java.util.Calendar getPostingDay()

getEntity

public ContentEntityObject getEntity()

getElementIdCreator

public ElementIdCreator getElementIdCreator()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class com.atlassian.renderer.RenderContext

hashCode

public int hashCode()
Overrides:
hashCode in class com.atlassian.renderer.RenderContext


Copyright © 2003-2014 Atlassian. All Rights Reserved.