public void setAttribute(Execution exec, String name, Object value) { ((ServletRequest)exec.getNativeRequest()).setAttribute(name, value); //can't access setAttribute directly, since signature of ZK 5 changed } public void removeAttribute(Execution exec, String name) {
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){
public Object getAttribute(Execution exec, String name) { return ((ServletRequest)exec.getNativeRequest()).getAttribute(name); } public void setAttribute(Execution exec, String name, Object value) {
/** 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); }
public Object getNativeRequest() { return exec().getNativeRequest(); }
/** * Returns the theme specified using the current theme resolution strategy * Default strategy is to use cookies * * @param exe Execution * @return the name of the theme or a fall back theme name determined by the * theme resolution strategy used. */ public static String getTheme(Execution exe) { ThemeResolver themeResolver = ThemeFns.getThemeResolver(); return themeResolver.getTheme((HttpServletRequest) exe.getNativeRequest()); }
/** * Returns the theme definition in effect, if any. Obtains the theme name from the theme * resolver, then looks it up in the theme registry. * * @param exec The current execution. * @return The active theme definition, or null to indicate use default. */ private ThemeDefinition getThemeDefinition(Execution exec) { String themeName = themeResolver.getTheme((HttpServletRequest) exec.getNativeRequest()); return themeRegistry.get(themeName); }
// 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 }
@SuppressWarnings("unchecked") public Object resolveParameter(Annotation anno, Class<?> returnType) { Map<String, Object> m = (Map<String, Object>) _execution.getAttribute(COOKIE_CACHE); if (m == null) { final Object req = _execution.getNativeRequest(); m = new HashMap<String, Object>(); _execution.setAttribute(COOKIE_CACHE, m); if (req instanceof HttpServletRequest) { final Cookie[] cks = ((HttpServletRequest) req).getCookies(); if (cks != null) { for (Cookie ck : cks) { m.put(ck.getName().toLowerCase(java.util.Locale.ENGLISH), ck.getValue()); } } } else /* if(req instanceof PortletRequest)*/ { //no cookie in protlet 1.0 } } Object val = m == null ? null : m.get(((CookieParam) anno).value().toLowerCase(java.util.Locale.ENGLISH)); return val == null ? null : Classes.coerce(returnType, val); } });
/*package*/ boolean isNativeScrollbar() { ServletRequest request = (ServletRequest) Executions.getCurrent().getNativeRequest(); // B70-ZK-2489: Set org.zkoss.zul.nativebar's default to false when using a mobile device if (Servlets.isBrowser(request, "ie8-")) { return true; } else { return Utils.testAttribute(this, "org.zkoss.zul.nativebar", true, true); } }
/** * 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); }
public void attributeRemoved(ServletRequestAttributeEvent evt) { final String name = evt.getName(); if (!shallIgnore(name)) { final Execution exec = Executions.getCurrent(); if (exec instanceof ExecutionImpl && evt.getServletRequest().equals(exec.getNativeRequest())) ((ExecutionImpl) exec).getScopeListeners().notifyRemoved(name); } }
public void attributeAdded(ServletRequestAttributeEvent evt) { final String name = evt.getName(); if (!shallIgnore(name)) { final Execution exec = Executions.getCurrent(); if (exec instanceof ExecutionImpl && evt.getServletRequest().equals(exec.getNativeRequest())) ((ExecutionImpl) exec).getScopeListeners().notifyAdded(name, evt.getValue()); } }
public void attributeReplaced(ServletRequestAttributeEvent evt) { final String name = evt.getName(); if (!shallIgnore(name)) { final Execution exec = Executions.getCurrent(); if (exec instanceof ExecutionImpl && evt.getServletRequest().equals(exec.getNativeRequest())) ((ExecutionImpl) exec).getScopeListeners().notifyReplaced(name, evt.getValue()); } } }
tmout = desktop.getSession().getMaxInactiveInterval(); } else { Object req = exec.getNativeRequest(); if (req instanceof HttpServletRequest) { final HttpSession hsess = ((HttpServletRequest) req).getSession(false);
final Execution exec = Executions.getCurrent(); if (exec != null) { Cookie[] cookies = ((HttpServletRequest) Executions.getCurrent().getNativeRequest()).getCookies(); String[] matchMedias = null; JSONObject args = new JSONObject();
ServletRequest request = (ServletRequest) exec.getNativeRequest(); ServletResponse response = (ServletResponse) exec.getNativeResponse(); ServletResponse resp = BufferedResponse.getInstance(response, new NullWriter());
/** Closes the execution such that other requests targeting * the same desktop can be processed. * It must be called. Otherwise, the whole desktop might not be able * to be accessed any more. */ public void close() { final HttpServletRequest request = (HttpServletRequest) _exec.getNativeRequest(); try { ((WebAppCtrl) _exec.getDesktop().getWebApp()).getUiEngine().closeUpdate(_updctx); _updctx = null; _exec = null; } catch (Exception ex) { //not possible throw UiException.Aide.wrap(ex); } finally { Charsets.cleanup(request, _locale); _locale = null; } } }
final Object req = exec.getNativeRequest(); log.debug("replicate request, SID: " + seqId + (req instanceof ServletRequest ? "\n" + Servlets.getDetail((ServletRequest) req) : ""));
} else { double[] ieCompatibilityInfo = Servlets .getIECompatibilityInfo((ServletRequest) exec.getNativeRequest()); if (ieCompatibilityInfo != null) { if (ieCompatibilityInfo[0] != ieCompatibilityInfo[2]) {