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


Java ModelAndView.hasView方法代码示例

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


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

示例1: handleRequest

import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@GetMapping(
		path = {"/oauth2.0/authorize"}
)
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
	J2EContext context = WebUtils.getPac4jJ2EContext(request, response);
	ProfileManager manager = WebUtils.getPac4jProfileManager(request, response);
	if(this.verifyAuthorizeRequest(request) && isRequestAuthenticated(manager, context)) {
		String clientId = context.getRequestParameter("client_id");
		OAuthRegisteredService registeredService = this.getRegisteredServiceByClientId(clientId);
		try {
			RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(clientId, registeredService);
		} catch (Exception var8) {
			LOGGER.error(var8.getMessage(), var8);
			return OAuth20Utils.produceUnauthorizedErrorView();
		}
		ModelAndView mv = this.consentApprovalViewResolver.resolve(context, registeredService);
		return !mv.isEmpty() && mv.hasView()?mv:this.redirectToCallbackRedirectUrl(manager, registeredService, context, clientId);
	} else {
		LOGGER.error("Authorize request verification failed");
		return OAuth20Utils.produceUnauthorizedErrorView();
	}
}
 
开发者ID:e-gov,项目名称:TARA-Server,代码行数:23,代码来源:OAuth20AuthorizeEndpointController.java

示例2: handleRequest

import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
/**
 * Handle request internal model and view.
 *
 * @param request  the request
 * @param response the response
 * @return the model and view
 * @throws Exception the exception
 */
@GetMapping(path = OAuth20Constants.BASE_OAUTH20_URL + '/' + OAuth20Constants.AUTHORIZE_URL)
public ModelAndView handleRequest(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    final J2EContext context = WebUtils.getPac4jJ2EContext(request, response);
    final ProfileManager manager = WebUtils.getPac4jProfileManager(request, response);

    if (!verifyAuthorizeRequest(request) || !isRequestAuthenticated(manager, context)) {
        LOGGER.error("Authorize request verification failed");
        return OAuth20Utils.produceUnauthorizedErrorView();
    }

    final String clientId = context.getRequestParameter(OAuth20Constants.CLIENT_ID);
    final OAuthRegisteredService registeredService = getRegisteredServiceByClientId(clientId);
    try {
        RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(clientId, registeredService);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
        return OAuth20Utils.produceUnauthorizedErrorView();
    }

    final ModelAndView mv = this.consentApprovalViewResolver.resolve(context, registeredService);
    if (!mv.isEmpty() && mv.hasView()) {
        return mv;
    }

    return redirectToCallbackRedirectUrl(manager, registeredService, context, clientId);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:35,代码来源:OAuth20AuthorizeEndpointController.java

示例3: postHandle

import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

	// we want to add usual model in modelAndView only when needed, ie with
	// direct html view :
	// not for download response (for example) because we don't need it
	// not for redirect view because we don't need it and we don't want that
	// they appears in the url

	if (modelAndView != null && modelAndView.hasView()) {

		boolean isViewObject = modelAndView.getView() == null;

		boolean isRedirectView = !isViewObject && modelAndView.getView() instanceof RedirectView;

		boolean viewNameStartsWithRedirect = isViewObject && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX);

		if (!isRedirectView && !viewNameStartsWithRedirect) {
			
			String esupNfcTagDroidApkUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-apk";
			modelAndView.addObject("esupNfcTagDroidApkUrl", esupNfcTagDroidApkUrl);
			String esupNfcTagDesktopJarUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-jar";
			modelAndView.addObject("esupNfcTagDesktopJarUrl", esupNfcTagDesktopJarUrl);
			
			// modelAndView.addObject("versionEsuSgc", AppliVersion.getCacheVersion());
			
		}
	
		if(request.getParameter("size")!=null) {
			Integer size = Integer.valueOf(request.getParameter("size"));
			request.getSession().setAttribute("size_in_session", size);
		} else if(request.getSession(false)!=null && request.getSession().getAttribute("size_in_session") == null) {
			request.getSession().setAttribute("size_in_session", new Integer(10));
		}
	
	}
}
 
开发者ID:EsupPortail,项目名称:esup-sgc,代码行数:38,代码来源:ConfigInterceptor.java

示例4: postHandle

import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		boolean isRedirectView = modelAndView!=null && modelAndView.getView() instanceof RedirectView;
//		boolean isViewObject = modelAndView.getView() == null;
		// if the view name is null then set a default value of true
		boolean viewNameStartsWithRedirect = (modelAndView!=null && modelAndView.getViewName() == null ? true
				: modelAndView!=null && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
		if (modelAndView!=null && modelAndView.hasView() && !isRedirectView && !viewNameStartsWithRedirect) {
			addCommonModelData(modelAndView);
		}
	}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:12,代码来源:YadaGlobalAttributesInterceptor.java


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