Accessing Java EE Scope Objects"
From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} =Executions= [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html org.zkoss.zk.ui.Executions] ==getCurrent== [http://...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html#getCurrent() Executions.getCurrent()] | [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Executions.html#getCurrent() Executions.getCurrent()] | ||
− | Retrieves the current execution | + | Retrieves the current execution which contains HTTP request/response. |
− | + | ||
+ | == get HttpServletRequest == | ||
+ | <syntaxhighlight lang="java"> | ||
+ | HttpServletRequest req = (HttpServletRequest)Executions.getCurrent().getNativeRequest() | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | [https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Execution.html#getNativeRequest() getNativeRequest()] | ||
=Sessions= | =Sessions= | ||
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions] | [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions] | ||
− | == | + | ==Get Current Session == |
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html#getCurrent() Sessions.getCurrent()] | [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html#getCurrent() Sessions.getCurrent()] | ||
− | Retrieves the current session. | + | Retrieves the current ZK-wrapped session. |
+ | |||
+ | == Get HttpSession == | ||
+ | <syntaxhighlight lang="java"> | ||
+ | HttpSession nativeSession = (HttpSession) Sessions.getCurrent().getNativeSession(); | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 06:12, 1 February 2024
Executions
getCurrent
Retrieves the current execution which contains HTTP request/response.
get HttpServletRequest
HttpServletRequest req = (HttpServletRequest)Executions.getCurrent().getNativeRequest()
Sessions
Get Current Session
Retrieves the current ZK-wrapped session.
Get HttpSession
HttpSession nativeSession = (HttpSession) Sessions.getCurrent().getNativeSession();