當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。