Accessing Java EE Scope Objects
Accessing Java EE Scope Objects
This section describes how to access Java EE scope objects (like HttpServletRequest and HttpSession) from ZK applications. These objects are essential for interacting with the underlying Java EE environment and accessing request/response data, session attributes, and other web container features.
These utilities provide a bridge between ZK’s component-based architecture and the standard Java EE web environment.
Executions
getCurrent
Retrieves the current execution which contains HTTP request/response.
get HttpServletRequest
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();