Class PageContext
- java.lang.Object
-
- com.atlassian.renderer.RenderContext
-
- com.atlassian.confluence.renderer.PageContext
-
- All Implemented Interfaces:
com.atlassian.renderer.links.LinkContext
,com.atlassian.renderer.RenderContextOutputType
- Direct Known Subclasses:
PageTemplateContext
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, except for when rendering Page Templates. When rendering a Page Template, use aPageTemplateContext
-
-
Constructor Summary
Constructors Constructor Description PageContext()
PageContext(ContentEntityObject entity)
PageContext(ContentEntityObject entity, PageContext previousContext)
Deprecated.since 4.3.PageContext(String spaceKey)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static PageContext
contextWithTimeout(ContentEntityObject entity, com.atlassian.util.concurrent.Timeout timeout)
Deprecated.since 7.0.1.static com.atlassian.util.concurrent.Timeout
createMinimumTimeout()
Deprecated.since 7.0.1.boolean
equals(Object o)
ElementIdCreator
getElementIdCreator()
ContentEntityObject
getEntity()
PageContext
getOriginalContext()
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 callRenderContext.getParam(Object)
with the parameter "output-device-type".@Nullable String
getPageTitle()
Calendar
getPostingDay()
String
getSpaceKey()
com.atlassian.util.concurrent.Timeout
getTimeout()
Deprecated.since 7.0.1.int
hashCode()
static io.atlassian.util.concurrent.Timeout
minimumTimeout()
Returns a timeout of 1 hour.static PageContext
newContextWithTimeout(ContentEntityObject entity, io.atlassian.util.concurrent.Timeout timeout)
Construct a new PageContext for the rendering of some entity within a given time.void
setOutputDeviceType(String type)
Set the output device type to be rendered for.io.atlassian.util.concurrent.Timeout
timeout()
SearchContext.Builder
toSearchContext()
Converts this PageContext to aSearchContext.Builder
, intended for use with macros that delegate content searching to theCQLSearchService
.-
Methods inherited from class com.atlassian.renderer.RenderContext
addExternalReference, addParam, addRenderedContent, addRenderedContent, getAttachmentsPath, getBaseUrl, getCharacterEncoding, getEmbeddedResourceRenderer, getEscaper, getExternalReferences, getImagePath, getLinkRenderer, getOutputType, getParam, getParams, getRenderedContentStore, getRenderMode, getSiteRoot, isRenderingForWysiwyg, popRenderMode, pushRenderMode, setAttachmentsPath, setBaseUrl, setCharacterEncoding, setEmbeddedResourceRenderer, setEscaper, setImagePath, setLinkRenderer, setOutputType, setRenderingForWysiwyg, setSiteRoot
-
-
-
-
Constructor Detail
-
PageContext
public PageContext()
-
PageContext
public PageContext(String spaceKey)
-
PageContext
public PageContext(ContentEntityObject entity)
-
PageContext
@Deprecated public PageContext(ContentEntityObject entity, PageContext previousContext)
Deprecated.since 4.3. The ability to have an original context is likely to be removed in a future versionConstructs a PageContext wrapping another pageContext.Uses the original PageContext's
Timeout
andRenderedContentStore
.
-
-
Method Detail
-
contextWithTimeout
@Deprecated public static PageContext contextWithTimeout(ContentEntityObject entity, com.atlassian.util.concurrent.Timeout timeout)
Deprecated.since 7.0.1. UsenewContextWithTimeout(ContentEntityObject, Timeout)
Construct a new PageContext for the rendering of some entity within a given time.
-
newContextWithTimeout
public static PageContext newContextWithTimeout(ContentEntityObject entity, io.atlassian.util.concurrent.Timeout timeout)
Construct a new PageContext for the rendering of some entity within a given time.- Since:
- 7.0.1
-
createMinimumTimeout
@Deprecated public static com.atlassian.util.concurrent.Timeout createMinimumTimeout()
Deprecated.since 7.0.1. UseminimumTimeout()
Returns a timeout of 1 hour. No conversion or rendering should ever take anything approaching that length.
-
minimumTimeout
public static io.atlassian.util.concurrent.Timeout minimumTimeout()
Returns a timeout of 1 hour. No conversion or rendering should ever take anything approaching that length.- Since:
- 7.0.1
-
getTimeout
@Deprecated public com.atlassian.util.concurrent.Timeout getTimeout()
Deprecated.since 7.0.1. Usetimeout()
- Returns:
- a timeout object indicating whether rendering has exceeded its allotted time.
-
timeout
public io.atlassian.util.concurrent.Timeout timeout()
- Returns:
- a timeout object indicating whether rendering has exceeded its allotted time.
- Since:
- 7.0.1
-
getOutputDeviceType
public 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 callRenderContext.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 callinggetParam("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(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 String getSpaceKey()
-
getPageTitle
public @Nullable String getPageTitle()
-
getPostingDay
public Calendar getPostingDay()
-
getEntity
public ContentEntityObject getEntity()
-
getElementIdCreator
public ElementIdCreator getElementIdCreator()
-
toSearchContext
public SearchContext.Builder toSearchContext()
Converts this PageContext to aSearchContext.Builder
, intended for use with macros that delegate content searching to theCQLSearchService
.
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classcom.atlassian.renderer.RenderContext
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.atlassian.renderer.RenderContext
-
-