/** * Called when a servlet/portlet completes the service of a request. * This method must be called if {@link #requestEnter} is called * and returns true. This method shall not be called, otherwise. * * @since 3.0.1 */ public static void requestExit(Session sess) { final Integer v = (Integer) sess.getAttribute(ATTR_REQUEST_COUNT); final int i = v != null ? v.intValue() - 1 : 0; sess.setAttribute(ATTR_REQUEST_COUNT, new Integer(i >= 0 ? i : 0)); }
public void cleanup(Execution exec, Execution parent, List errs) throws Exception { Session sess = exec.getSession(); //enforce GAE to write session //enforce Weblogic to sync session if (sess != null) sess.setAttribute(Attributes.ZK_SESSION, sess.getAttribute(Attributes.ZK_SESSION)); }
/** Called when a servlet/portlet starts to serve a request. * It checks whether the number of concurrent requests per session * exceeds the number specified in * {@link org.zkoss.zk.ui.util.Configuration#getSessionMaxRequests}. * If exceeded, false is returned, and the servlet/portlet shall stop * processing and return an error code back the client. * * <p>If not exceeded, true is returned, and the servlet/portlet * can continue the processing and it shall invoke {@link #requestExit} * in the finally clause. * * @since 3.0.1 */ public static boolean requestEnter(Session sess) { final Integer v = (Integer) sess.getAttribute(ATTR_REQUEST_COUNT); final int i = v != null ? v.intValue() + 1 : 1; final int max = sess.getWebApp().getConfiguration().getSessionMaxRequests(); if (max < 0 || i <= max) { sess.setAttribute(ATTR_REQUEST_COUNT, new Integer(i)); return true; } return false; }
/** * Submits the authentication request. */ private void doSubmit() { showMessage(""); final Organization organization = getSelectedOrganization(); String instId = organization == null ? null : organization.getId().getIdPart(); String username = j_username.getValue().trim(); final String password = j_password.getValue(); if (username.contains("\\")) { String[] pcs = username.split("\\\\", 2); instId = pcs[0]; username = pcs[1]; } if (!username.isEmpty() && !password.isEmpty() && !instId.isEmpty()) { session.setAttribute(Constants.DEFAULT_INSTITUTION, instId); FrameworkWebSupport.setCookie(Constants.DEFAULT_INSTITUTION, instId); session.setAttribute(Constants.DEFAULT_USERNAME, username); //FrameworkWebSupport.setCookie(Constants.DEFAULT_USERNAME, username); j_username.setValue(instId + "\\" + username); showState(Labels.getLabel(Constants.LBL_LOGIN_PROGRESS)); session.setAttribute(org.carewebframework.security.spring.Constants.SAVED_REQUEST, savedRequest); Events.sendEvent("onSubmit", loginRoot.getRoot(), null); } else { showMessage(Labels.getLabel(Constants.LBL_LOGIN_REQUIRED_FIELDS)); } }
/** * Submits the authentication request. */ public void onSubmit() { showMessage(""); ISecurityDomain securityDomain = getSelectedSecurityDomain(); String securityDomainId = securityDomain == null ? null : securityDomain.getLogicalId(); String username = txtUsername.getValue().trim(); String password = txtPassword.getValue(); if (username.contains("\\")) { String[] pcs = username.split("\\\\", 2); securityDomainId = pcs[0]; username = pcs[1]; } if (!username.isEmpty() && !password.isEmpty() && !securityDomainId.isEmpty()) { session.setAttribute(Constants.DEFAULT_SECURITY_DOMAIN, securityDomainId); FrameworkWebSupport.setCookie(Constants.DEFAULT_SECURITY_DOMAIN, securityDomainId); session.setAttribute(Constants.DEFAULT_USERNAME, username); txtUsername.setValue(securityDomainId + "\\" + username); showStatus(StrUtil.getLabel(Constants.LBL_LOGIN_PROGRESS)); session.setAttribute(org.carewebframework.security.spring.Constants.SAVED_REQUEST, savedRequest); Events.sendEvent("onSubmit", loginRoot.getRoot(), null); } else { showMessage(StrUtil.getLabel(Constants.LBL_LOGIN_REQUIRED_FIELDS)); pane.setVisible(true); } }
public Object setAttribute(String name, Object value, boolean recurse) { if (recurse && !hasAttribute(name)) { if (_sess != null) { if (_sess.hasAttribute(name, true)) return _sess.setAttribute(name, value, true); } else if (_wapp != null) { if (_wapp.hasAttribute(name, true)) return _wapp.setAttribute(name, value, true); } } return setAttribute(name, value); }
/** * Set the location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog. * @param filebrowserImageBrowseUrl */ public void setFilebrowserImageBrowseUrl(String filebrowserImageBrowseUrl) { boolean isSetted = false; if (!Objects.equals(_filebrowserImageBrowseUrl, filebrowserImageBrowseUrl)) { this._filebrowserImageBrowseUrl = filebrowserImageBrowseUrl; String url = String.valueOf(new EncodedURL(filebrowserImageBrowseUrl).getValue()); Executions.getCurrent().getSession().setAttribute("filebrowserImageBrowseUrl"+this.getUuid(),url); isSetted = true; } smartUpdate("filebrowserImageBrowseUrl", isSetted);//won't send the url info to client }
/** * Set the location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog. * @param filebrowserFlashBrowseUrl */ public void setFilebrowserFlashBrowseUrl(String filebrowserFlashBrowseUrl) { boolean isSetted = false; if (!Objects.equals(_filebrowserFlashBrowseUrl, filebrowserFlashBrowseUrl)) { this._filebrowserFlashBrowseUrl = filebrowserFlashBrowseUrl; String url = String.valueOf(new EncodedURL(filebrowserFlashBrowseUrl).getValue()); Executions.getCurrent().getSession().setAttribute("filebrowserFlashBrowseUrl"+this.getUuid(), url); isSetted = true; } smartUpdate("filebrowserFlashBrowseUrl", isSetted);//won't send the url info to client }
/** * Set the location of an external file browser, that should be launched when "Browse Server" button is pressed. * @param filebrowserBrowseUrl */ public void setFilebrowserBrowseUrl(String filebrowserBrowseUrl) { boolean isSetted = false; if (!Objects.equals(_filebrowserBrowseUrl, filebrowserBrowseUrl)) { this._filebrowserBrowseUrl = filebrowserBrowseUrl; String url = String.valueOf(new EncodedURL(filebrowserBrowseUrl).getValue()); Executions.getCurrent().getSession().setAttribute("filebrowserBrowseUrl"+this.getUuid(), url); isSetted = true; } smartUpdate("filebrowserBrowseUrl", isSetted);//won't send the url info to client }
boolean show = pi == null; if (show) sess.setAttribute(ATTR_PI, new PI()); else show = pi.show();
--cnt; _sess.setAttribute(ATTR_PUSH_COUNT, new Integer(cnt)); } else if (enable) {
private void checkAuthResult(AuthResult result, IUser user) throws AuthenticationException { switch (result.status) { case SUCCESS: return; case CANCELED: throw new AuthenticationCancelledException(StringUtils.defaultIfEmpty(result.reason, "Authentication attempt was cancelled.")); case EXPIRED: Sessions.getCurrent().setAttribute(org.carewebframework.security.spring.Constants.SAVED_USER, user); throw new CredentialsExpiredException( StringUtils.defaultIfEmpty(result.reason, "Your password has expired.")); case FAILURE: throw new BadCredentialsException(StringUtils.defaultIfEmpty(result.reason, "Your username or password was not recognized.")); case LOCKED: throw new LockedException(StringUtils.defaultIfEmpty(result.reason, "Your user account has been locked and cannot be accessed.")); case NOLOGINS: throw new DisabledException(StringUtils.defaultIfEmpty(result.reason, "Logins are currently disabled.")); } }