当前位置: 首页>>代码示例>>Java>>正文


Java WebUtils.redirectToSavedRequest方法代码示例

本文整理汇总了Java中org.apache.shiro.web.util.WebUtils.redirectToSavedRequest方法的典型用法代码示例。如果您正苦于以下问题:Java WebUtils.redirectToSavedRequest方法的具体用法?Java WebUtils.redirectToSavedRequest怎么用?Java WebUtils.redirectToSavedRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.shiro.web.util.WebUtils的用法示例。


在下文中一共展示了WebUtils.redirectToSavedRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: issueSuccessRedirect

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
protected void issueSuccessRedirect(ServletRequest request, ServletResponse response)
		throws Exception {
	HttpServletRequest req = (HttpServletRequest) request;
	HttpServletResponse res = (HttpServletResponse) response;
	String successUrl = req.getParameter(RETURN_URL);
	if (StringUtils.isBlank(successUrl)) {
		if (req.getRequestURI().startsWith(
				req.getContextPath() + getAdminPrefix())) {
			// 后台直接返回首页
			successUrl = getAdminIndex();
			// 清除SavedRequest
			WebUtils.getAndClearSavedRequest(request);
			WebUtils.issueRedirect(request, response, successUrl, null,true);
			return;
		} else {
			successUrl = getSuccessUrl();
		}
	}
	WebUtils.redirectToSavedRequest(req, res, successUrl);
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:21,代码来源:CmsAuthenticationFilter.java

示例2: isAccessAllowed

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@Override
protected boolean isAccessAllowed(ServletRequest request,
		ServletResponse response, Object mappedValue) throws Exception {
	System.out.println("access allowed");
	saveRequest(request);
	boolean flag = isLoginRequest(request,response);
	System.out.println("啊鹅鹅鹅饿          "+flag);
	if(flag){
		System.out.println("是是是是是是是");
		 saveRequestAndRedirectToLogin(request,response);
	}
	//saveRequestAndRedirectToLogin(request,response);
      // return true;
	//return false;
       if(SecurityUtils.getSubject().isAuthenticated()) { 
       	String successUrl = WebUtils.getSavedRequest(request).getRequestUrl();
       	WebUtils.redirectToSavedRequest(request, response, successUrl);  
           return true;//已经登录过  
       }else {//保存当前地址并重定向到登录界面  
           saveRequestAndRedirectToLogin(request, response);  
           saveRequest(request);
           return false;  
       }  
}
 
开发者ID:GlacierSoft,项目名称:netloan-project,代码行数:25,代码来源:MyAccessControlFilter.java

示例3: doLogin

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
@POST
@Path("/login")
public void doLogin(
        @Context HttpServletRequest request,
        @Context HttpServletResponse response,
        @FormParam("username") String username,
        @FormParam("password") String password)
        throws IOException
{
    Subject currentUser = SecurityUtils.getSubject();
    if (!currentUser.isAuthenticated()) {
        AuthenticationToken token = new UsernamePasswordToken(username, password);
        currentUser.login(token);
    }

    WebUtils.redirectToSavedRequest(request, response, "/app");
}
 
开发者ID:airbnb,项目名称:airpal,代码行数:18,代码来源:SessionResource.java

示例4: issueSuccessRedirect

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * 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());
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:13,代码来源:AuthenticationFilter.java


注:本文中的org.apache.shiro.web.util.WebUtils.redirectToSavedRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。