public void sendRedirect(String uri, boolean respRedirect) { if (!respRedirect) { sendRedirect(uri); return; } else { uri = uri == null ? "" : uri; HttpServletResponse resp = (HttpServletResponse) getNativeResponse(); try { String destUrl = encodeURL(uri); String destUrlParam = URLEncoder.encode(destUrl, "utf-8"); String updateURI = _desktop.getUpdateURI( AuRedirect.URI_PREFIX + "?" + AuRedirect.REDIRECT_URL_PARAMETER + "=" + destUrlParam); updateURI = resp.encodeRedirectURL(updateURI); resp.setHeader("Location", updateURI); resp.setStatus(HttpServletResponse.SC_FOUND); } catch (UnsupportedEncodingException e) { _zklog.warn("", e); } } }
_dls.put(path, new Character(type)); return desktop.getUpdateURI(sb.toString());
public void render(Page page, Writer out) throws IOException { out.write(HtmlPageRenders.outLangStyleSheets(_exec, null, null)); out.write(HtmlPageRenders.outLangJavaScripts(_exec, null, null)); if (_pageDOM) { HtmlPageRenders.outPageContent(_exec, page, out, false); return; } final Desktop desktop = _exec.getDesktop(); out.write("<script class=\"z-runonce\" type=\"text/javascript\">zkpb('"); out.write(page.getUuid()); out.write("','"); out.write(desktop.getId()); out.write("','"); out.write(getContextURI()); out.write("','"); out.write(desktop.getUpdateURI(null)); out.write("','"); out.write(desktop.getRequestPath()); out.write('\''); String style = page.getStyle(); if (style != null && style.length() > 0) { out.write(",{style:'"); out.write(style); out.write("'}"); } out.write(");zkpe();</script>\n"); for (Component root = page.getFirstRoot(); root != null; root = root.getNextSibling()) { HtmlPageRenders.outStandalone(_exec, root, out); } }
if (desktop != null && exec.getAttribute(ATTR_DESKTOP_JS_GENED) == null) { sb.append("<script class=\"z-runonce\" type=\"text/javascript\">\nzkdt('").append(desktop.getId()) .append("','").append(getContextURI(exec)).append("','").append(desktop.getUpdateURI(null)) .append("','").append(desktop.getRequestPath()).append("');").append(outSpecialJS(desktop)) .append("\n</script>\n");
out.write(getContextURI(exec)); out.write("','"); out.write(desktop.getUpdateURI(null)); out.write("','"); out.write(desktop.getRequestPath());
protected void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException { if (url == null) { return; //skip } final Event evt = (Event) (request).getSession().getAttribute(ZkEventExceptionFilter.EVENT); final Component comp = evt.getTarget(); final String updateURI = comp.getDesktop().getUpdateURI(null); if (url.indexOf(updateURI) >= 0) { //saved request Events.postEvent(new Event(ON_LOGIN_OK, comp, null)); //post onLoginOK event if (_resendZkEvent) { (request).getSession().removeAttribute(ZkEventExceptionFilter.EVENT); Events.postEvent(evt); } return; } //must redirect if (url.startsWith("http://") || url.startsWith("https://")) { Executions.getCurrent().sendRedirect(url); return; } //other url, assume login fail if (!comp.isListenerAvailable(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, true)) { final EventListener<Event> listener = new ShowWindowEventListener<Event>(); comp.setAttribute(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, listener); comp.addEventListener(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, listener); } Events.postEvent(new Event(ZkAuthenticationEntryPoint.ON_ACEGILOGIN, comp, url)); }
appendProp(props, "dt", desktop.getId()); appendProp(props, "cu", getContextURI(exec)); appendProp(props, "uu", desktop.getUpdateURI(null)); appendProp(props, "ru", desktop.getRequestPath());