/** * Redirects to user to the previously attempted URL after a successful login. This implementation simply calls * <code>{@link org.apache.shiro.web.util.WebUtils WebUtils}.{@link WebUtils#redirectToSavedRequest(javax.servlet.ServletRequest, javax.servlet.ServletResponse, String) redirectToSavedRequest}</code> * using the {@link #getSuccessUrl() successUrl} as the {@code fallbackUrl} argument to that call. * * @param request the incoming request * @param response the outgoing response * @throws Exception if there is a problem redirecting. */ protected void issueSuccessRedirect(ServletRequest request, ServletResponse response) throws Exception { WebUtils.redirectToSavedRequest(request, response, getSuccessUrl()); }
protected void dynaRedirect(ServletRequest request, ServletResponse response, String url, boolean returnJson) throws Exception { if (returnJson) { Map<String, Object> parameterMap = new HashMap<String, Object>(); Enumeration<String> attrNames = request.getAttributeNames(); String name = ""; while (attrNames.hasMoreElements()) { name = attrNames.nextElement(); parameterMap.put(name, request.getAttribute(name)); } PrintWriter writer = null; try { response.setCharacterEncoding("UTF-8"); writer = response.getWriter(); writer.write(JsonKit.toJson(parameterMap)); writer.flush(); } catch (IOException e) { throw new IOException(e); } finally { if (writer != null) writer.close(); } } else WebUtils.redirectToSavedRequest(request, response, url); }
protected void dynaRedirect(ServletRequest request, ServletResponse response, String url, boolean returnJson) throws Exception { if (returnJson) { Map<String, Object> parameterMap = new HashMap<String, Object>(); Enumeration<String> attrNames = request.getAttributeNames(); String name = ""; while (attrNames.hasMoreElements()) { name = attrNames.nextElement(); parameterMap.put(name, request.getAttribute(name)); } PrintWriter writer = null; try { response.setCharacterEncoding("UTF-8"); writer = response.getWriter(); writer.write(JsonKit.toJson(parameterMap)); writer.flush(); } catch (IOException e) { throw new IOException(e); } finally { if (writer != null) writer.close(); } } else WebUtils.redirectToSavedRequest(request, response, url); }