本文整理了Java中org.zkoss.zk.ui.Execution
类的一些代码示例,展示了Execution
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution
类的具体详情如下:
包路径:org.zkoss.zk.ui.Execution
类名称:Execution
[英]An execution of a client request (e.g., ServletRequest). When a request sent from a client, the server constructs a Executionobject to hold execution relevant info, and then serves the request thru this execution.
A client request, e.g., HttpServletRequest, might consist of multiple ZK request ( org.zkoss.zk.au.AuRequest). However, these ZK requests must target the same desktop of pages ( Page).
Because a request might come from HTTP or other protocol, Execution also serves as an isolation layer.
[中]客户端请求的执行(例如ServletRequest)。当从客户端发送请求时,服务器构造一个Executionobject来保存与执行相关的信息,然后通过该执行为请求提供服务。
一个客户端请求,例如HttpServletRequest,可能包含多个ZK请求(org.zkoss.ZK.au.AuRequest)。但是,这些ZK请求必须针对相同的桌面页面(第页)。
因为请求可能来自HTTP或其他协议,所以执行也充当隔离层。
代码示例来源:origin: org.zkoss.zk/zk
/** Ensure the use of component is correct. */
private void checkDesktop(Component comp) {
final Desktop dt = comp.getDesktop();
if (dt != null && dt != _exec.getDesktop())
throw new IllegalStateException(
"Access denied: component, " + comp + ", belongs to another desktop: " + dt);
}
代码示例来源:origin: org.zkoss.zk/zk
public String getUpdateURI(String pathInfo) {
final String uri;
if (pathInfo == null || pathInfo.length() == 0) {
uri = _updateURI;
} else {
if (pathInfo.charAt(0) != '/')
pathInfo = '/' + pathInfo;
uri = _updateURI + pathInfo;
}
return _exec.encodeURL(uri);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Constructor.
*
* @param exec the current execution, never null
* @param locator the locator used to locate taglib and other resources.
* If null, {@link #getWebApp} is used.
*/
public RequestInfoImpl(Execution exec, Locator locator) {
this(exec.getDesktop(), exec.getNativeRequest(), locator);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Returns the page redraw control.
* It first check if a request attribute called
* {@link Attributes#PAGE_REDRAW_CONTROL} is defined.
* If not, it checks a request parameter called <code>zk.redrawCtrl</code>
* is defined. If none of them is defined, null is returned.
* @since 5.0.0
*/
public static final String getPageRedrawControl(Execution exec) {
String ctl = (String) exec.getAttribute(Attributes.PAGE_REDRAW_CONTROL);
return ctl != null ? ctl : exec.getParameter("zk.redrawCtrl");
}
}
代码示例来源:origin: org.zkoss.zk/zk
/** Sets whether a component can directly generate HTML tags
* to the output.
* @see #isDirectContent
*/
public static boolean setDirectContent(Execution exec, boolean direct) {
return (direct ? exec.setAttribute(ATTR_DIRECT_CONTENT, Boolean.TRUE)
: exec.removeAttribute(ATTR_DIRECT_CONTENT)) != null;
}
代码示例来源:origin: org.zkoss.zk/zk
/** Generates the unavailable message in HTML tags, if any.
* @param exec the execution (never null)
*/
public static String outUnavailable(Execution exec) {
if (exec.getAttribute(ATTR_UNAVAILABLE_GENED) == null && !exec.isAsyncUpdate(null)) {
exec.setAttribute(ATTR_UNAVAILABLE_GENED, Boolean.TRUE);
final Device device = exec.getDesktop().getDevice();
String s = device.getUnavailableMessage();
return s != null ? "<noscript>\n" + s + "\n</noscript>" : "";
}
return ""; //nothing to generate
}
代码示例来源:origin: org.zkoss.zk/zkbind
public BindingExecutionInfoCollector getExecutionInfoCollector() {
Execution exec = Executions.getCurrent();
if (exec == null)
return null;
BindingExecutionInfoCollector collector = (BindingExecutionInfoCollector) exec.getAttribute(COLLECTOR_KEY);
if (collector == null) {
collector = createBindingExecutionInfoCollector();
exec.setAttribute(COLLECTOR_KEY, collector);
}
return collector;
}
代码示例来源:origin: org.zkoss.zk/zuljsp
public void removeAttribute(Execution exec, String name) {
((ServletRequest)exec.getNativeRequest()).removeAttribute(name);
//can't access removeAttribute directly, since signature of ZK 5 changed
}
public Inline newInline(String txt){
代码示例来源:origin: org.zkoss.zk/zk
/** Returns the first line to be generated to the output,
* or null if no special first line.
*/
public static final String outFirstLine(Execution exec, Page page) {
if (exec.getAttribute(FIRST_LINE_GENED) == null && !exec.isAsyncUpdate(null)) {
exec.setAttribute(FIRST_LINE_GENED, Boolean.TRUE);
return trimAndLF(((PageCtrl) page).getFirstLine());
}
return "";
}
代码示例来源:origin: org.zkoss.zk/zk
public void doInit(Page page, Map<String, Object> args) throws Exception {
//first called doInit, last called doAfterCompose
final Execution exec = Executions.getCurrent();
if (exec.getAttribute(RESOLVE_COMPOSITION) == null) {
exec.setAttribute(RESOLVE_COMPOSITION, this);
}
final Component parent = (Component) exec.getAttribute(PARENT);
for (Object arg : args.values())
exec.createComponents((String) arg, parent, null);
}
代码示例来源:origin: org.zkoss.zk/zul
private Map<String, Object> setupDynams(Execution exec) {
if (_dynams == null || _dynams.isEmpty())
return null;
final Map<String, Object> old = new HashMap<String, Object>();
for (Map.Entry<String, Object> me : _dynams.entrySet()) {
final String nm = me.getKey();
final Object val = me.getValue();
old.put(nm, exec.getAttribute(nm));
if (val != null)
exec.setAttribute(nm, val);
else
exec.removeAttribute(nm);
}
return old;
}
代码示例来源:origin: org.zkoss.zk/zkplus
exec.setAttribute(ZkEventExceptionFilter.EXCEPTION, ex);
exec.setAttribute(ZkEventExceptionFilter.COMPONENT, comp);
exec.setAttribute(ZkEventExceptionFilter.EVENT, evt);
exec.setAttribute(ZkAuthenticationProcessingFilter.CURRENT_EVENT, evt);
ServletRequest request = (ServletRequest) exec.getNativeRequest();
ServletResponse response = (ServletResponse) exec.getNativeResponse();
ServletResponse resp = BufferedResponse.getInstance(response, new NullWriter());
try {
代码示例来源:origin: org.zkoss.zk/zk
public void doAfterCompose(Page page, Component[] comps) throws Exception {
final Execution exec = Executions.getCurrent();
//resolve only once in the last page
if (exec.getAttribute(RESOLVE_COMPOSITION) != this) {
return;
}
exec.removeAttribute(RESOLVE_COMPOSITION);
// resolve insert components
final Map<String, Component> insertMap = new HashMap<String, Component>(); //(insert name, insert component)
final Component parent = (Component) exec.getAttribute(PARENT);
final Collection<Component> roots = (parent == null ? page.getRoots() : parent.getChildren());
resolveInsertComponents(roots, insertMap);
//B65-ZK-2072: Resolves define components recursively.
resolveDefineComponents(roots, insertMap);
}
代码示例来源:origin: org.zkoss.zk/zk
public boolean remove(String name, String scope) {
final Execution exec = Executions.getCurrent();
if (exec == null)
throw new IllegalStateException("Not in an execution");
if (EventQueues.DESKTOP.equals(scope))
return remove0(name, exec.getDesktop());
if (EventQueues.APPLICATION.equals(scope))
return remove0(name, exec.getDesktop().getWebApp());
if (EventQueues.SESSION.equals(scope))
return remove0(name, exec.getSession());
return false;
}
代码示例来源:origin: stackoverflow.com
// check if request needs to be sent back
if (!isValidRequest()) {
// get the current execution context
Execution exec = Executions.getCurrent();
// retrieve HTTP request, response objects
HttpServletRequest request = (HttpServletRequest) exec.getNativeRequest();
HttpServletResponse response = (HttpServletResponse) exec.getNativeResponse();
// get the referring URL from HTTP header
String referrer = request.getHeader("Referer");
/* don't need to use this unless doing a forward (server-side)
if (referrer != null) {
URL ref = new URL(referrer);
referrer = ref.getPath().substring(request.getContextPath().length());
} else {
referrer = "/index.jsp"; // home page
}
*/
// HTTP 301 redirect (client-side); encoding ensures URL rewriting if required
response.sendRedirect(response.encodeRedirectURL(referrer));
exec.setVoided(true); // no need to create UI; about to redirect
}
代码示例来源:origin: org.carewebframework/org.carewebframework.ext.performance
Desktop desktop = exec.getDesktop();
String command = exec.getParameter("cmd_0");
if ("dummy".equals(command)) {
return;
代码示例来源:origin: org.zkoss.zk/zk
public void onEvent(Event evt) throws Exception {
for (int j = _targets.length; --j >= 0;)
_targets[j].removeEventListener(_evtnms[j], this); //one shot only
final Execution exec = Executions.getCurrent();
execCreate0(
new CreateInfo(((WebAppCtrl) exec.getDesktop().getWebApp()).getUiFactory(), exec, _comp.getPage(),
null), //technically sys composer can be used but we don't (to simplify it)
_compInfo, _comp, null);
if (_uri != null) {
final String uri = (String) Evaluators.evaluate(_compInfo.getEvaluator(), _comp, _uri, String.class);
if (uri != null)
exec.createComponents(uri, _comp, null);
}
Events.sendEvent(new FulfillEvent(Events.ON_FULFILL, _comp, evt));
//Use sendEvent so onFulfill will be processed before
//the event triggers the fulfill (i.e., evt)
}
代码示例来源:origin: org.zkoss.zk/zk
public Component[] createComponents(String uri, Component parent, Component insertBefore,
VariableResolver resolver, Map<?, ?> arg) {
return exec().createComponents(uri, parent, insertBefore, resolver, arg);
}
代码示例来源:origin: org.zkoss.zk/zul
/**
* Sets the theme name using the current theme resolution strategy
* Default strategy is to use cookies
*
* @param exe Execution
* @param themeName the new intended theme name
*/
public static void setTheme(Execution exe, String themeName) {
ThemeResolver themeResolver = ThemeFns.getThemeResolver();
themeResolver.setTheme((HttpServletRequest) exe.getNativeRequest(),
(HttpServletResponse) exe.getNativeResponse(), themeName);
}
代码示例来源:origin: org.zkoss.zk/zk
/** Returns the render context, or null if not available.
* It is used to render the content that will appear before the content
* generated by {@link ContentRenderer}, such as crawlable content.
*
* @param exec the execution. If null, {@link Executions#getCurrent}
* is assumed.
*/
public static final RenderContext getRenderContext(Execution exec) {
if (exec == null)
exec = Executions.getCurrent();
return exec != null ? (RenderContext) exec.getAttribute(ATTR_RENDER_CONTEXT) : null;
}
内容来源于网络,如有侵权,请联系作者删除!