Changes for page Async Rendering

Last modified by Thomas Mortagne on 2022/12/30 17:36

<
From version < 12.1 >
edited by Thomas Mortagne
on 2019/09/20 15:30
To version < 14.1 >
edited by Thomas Mortagne
on 2020/04/16 15:28
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,9 +4,11 @@
4 4  
5 5  Support for asynchronous execution is integrated in:
6 6  
7 +* Pages (for the execution of the content)
7 7  * [[Panels>>Extension.Panels Application]]
8 8  * [[UI extensions>>Extension.UIExtension Module]]
9 9  * [[Wiki macros>>Extension.WikiMacroStore]]
11 +* [[Templates>>Extension.Template Module]]
10 10  
11 11  There is also two public entry points to manipulate contextual information related to the asynchronous rendering:
12 12  
... ... @@ -21,18 +21,18 @@
21 21  
22 22  * **##flushCache##**: remove from the cache all the result of asynchronous rendering
23 23  
24 -= Context entries
26 += Context entries =
25 25  
26 -== Standard context entries
28 +== Standard context entries ==
27 27  
28 -* ##user##: the reference of the current user ({{code language="velocity"}}$xcontext.userReference{{/code}})
29 -* ##author##: the reference of the author of the currently executed script (##XWikiContext#getAuthorReference##)
30 -* ##doc.reference##: the reference of the current document ({{code language="velocity"}}$doc.documentReference{{/code}})
30 +* ##user##: the reference of the current user ({{code language="velocity"}}$xcontext.userReference{{/code}}), fallback on the author when not set
31 +* ##author##: the reference of the author of the currently executed script (##XWikiContext#getAuthorReference##), superadmin if not set
32 +* ##doc.reference##: the reference of the current document ({{code language="velocity"}}$doc.documentReference{{/code}}), the wiki home page if not set
31 31  * ##wiki##: the identifier of the current wiki ({{code language="velocity"}}$xcontext.database{{/code}})
32 32  * ##secureDocument##: {{info}}since 10.11.1/11.0{{/info}} the reference of the current secure document (which contains the current ##author##)
33 33  * ##request.url##: the URL received by XWiki
34 34  * ##request.parameters##: the parameters received by XWiki ({{code language="velocity"}}$request.parameterMap{{/code}})
35 -* ##request.base##: the first part of the URL (##<protocol>://<host:<port>##) received by XWiki. Also imply ##request.contextpath##.
37 +* ##request.base##: the first part of the URL (##<protocol>~://<host:<port>//##//) received by XWiki. Also imply ##request.contextpath##.//
36 36  * ##request.contextpath##: {{info}}since 10.11.1/11.0{{/info}} the part following the base URL (usually ##xwiki## unless the configuration has been changed)
37 37  * ##request.wiki##: the wiki corresponding to the URL received by XWiki (could be different from the current wiki when the async execution is triggered).
38 38  * ##request.*##: imply all the request related context elements
... ... @@ -42,7 +42,7 @@
42 42  * ##targetsyntax##: {{info}}since 11.8{{/info}} the value of ##org.xwiki.rendering.transformation.RenderingContext#getDefaultSyntax##
43 43  * ##restricted##: {{info}}since 11.8{{/info}} the value of ##org.xwiki.rendering.transformation.RenderingContext#isRestricted##
44 44  
45 -== Custom context entries
47 +== Custom context entries ==
46 46  
47 47  Any extension can provide its own context elements. For this you will need to provider a component implementing the role ##org.xwiki.context.concurrent.ContextStore## and have any unique role hint:
48 48  
... ... @@ -58,15 +58,16 @@
58 58  rendering.async.context.entry.wiki=Wiki
59 59  {{/code}}
60 60  
61 -= Caching
63 += Caching =
62 62  
63 63  When you enable cache the result of the execution will be stored in a memory cache and automatically invalidated when an event related to one of the associated resources (document, components, etc.) is received.
64 64  
65 65  XWiki is doing its best to automatically associate many things but sometimes it's not easy to do it automatically (for example when you use database requests) and you will need to be a bit more explicit. For this you can use the various "use" API described in previous sections.
66 66  
67 -== Resource which are automatically "used"
69 +== Resource which are automatically "used" ==
68 68  
69 69  You won't need to call ###use## API for the following elements:
72 +
70 70  * anything that end up calling ##XWiki#getDocument## will automatically cause the document reference to be associated
71 71  * any lookup for a component or a component list will automatically be associated
72 72  * {{info}}since 11.8{{/since}} any security right check is associated
... ... @@ -75,4 +75,4 @@
75 75  
76 76  {{info}}since 11.8{{/info}}
77 77  
78 -It's possible to force skipping the cache by sending the HTTP header ##Cache-Control## with value "no-cache". Fortnately this is something the browser does when you force refresh (##SHIFT+F5## or ##CTRL+SHIFT+R## usually) so using forcing refresh in your browser will not only affect the browser cache but also the async rendering server side cache.
81 +It's possible to force skipping the cache by sending the HTTP header ##Cache-Control## with value "no-cache". Fortnately this is something the browser does when you force refresh (##SHIFT+F5## or ##CTRL+SHIFT+R## usually) so using forcing refresh in your browser will not only affect the browser cache but also the async rendering server side cache.{{/info}}

Get Connected