本文整理汇总了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();
}
}
示例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);
}
示例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));
}
}
}
示例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);
}
}