當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelAndView.setView方法代碼示例

本文整理匯總了Java中org.springframework.web.servlet.ModelAndView.setView方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelAndView.setView方法的具體用法?Java ModelAndView.setView怎麽用?Java ModelAndView.setView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.servlet.ModelAndView的用法示例。


在下文中一共展示了ModelAndView.setView方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: servicePortalFind

import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@RequestMapping ( "/find-service/{releasePackage}/{serviceName}" )
public ModelAndView servicePortalFind (
										@PathVariable String serviceName,
										@PathVariable String releasePackage ) {

	ModelAndView mav = new ModelAndView();
	mav.setView( new RedirectView( CsapCoreService.ADMIN_URL, true, false, true ) );

	logger.info( "Redirecting based on package {}  and service {}", releasePackage, serviceName );

	mav.getModel().put( CSAP.PACKAGE_PARAM, releasePackage );

	// use the first instance to determine the default admin service
	ServiceInstance instance = application
		.serviceInstancesByName( releasePackage, serviceName )
		.stream()
		.findFirst()
		.get();

	mav.getModel().put( CSAP.SERVICE_PORT_PARAM, instance.getServiceName_Port() );
	mav.getModel().put( CSAP.HOST_PARAM, instance.getHostName() );

	return mav;
}
 
開發者ID:csap-platform,項目名稱:csap-core,代碼行數:25,代碼來源:CorePortals.java

示例2: resolveException

import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@Override
public ModelAndView resolveException(HttpServletRequest httpServletRequest,
    HttpServletResponse httpServletResponse, Object o, Exception e) {
  HttpDownServer.LOGGER.error("rest error:",e);
  ModelAndView modelAndView = new ModelAndView();
  try {
    ResultInfo resultInfo = new ResultInfo().setStatus(ResultStatus.ERROR.getCode())
        .setMsg(ResultInfo.MSG_ERROR);
    Map<String, Object> attr = JSON.parseObject(JSON.toJSONString(resultInfo), Map.class);
    MappingJackson2JsonView view = new MappingJackson2JsonView();
    view.setAttributesMap(attr);
    modelAndView.setView(view);
  } catch (Exception e1) {
    e1.printStackTrace();
  }
  return modelAndView;
}
 
開發者ID:monkeyWie,項目名稱:proxyee-down,代碼行數:18,代碼來源:RestExceptionHandler.java

示例3: postHandle

import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@Override
public void postHandle(final HttpServletRequest request, final HttpServletResponse response,
                       final Object handler, final ModelAndView modelAndView) throws Exception {
    if (!StringUtils.isEmpty(request.getQueryString())
            && request.getQueryString().contains(CasProtocolConstants.PARAMETER_TICKET)) {
        final RedirectView v = new RedirectView(request.getRequestURL().toString());
        v.setExposeModelAttributes(false);
        v.setExposePathVariables(false);
        modelAndView.setView(v);
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:12,代碼來源:CasManagementSecurityInterceptor.java

示例4: postHandle

import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
@Override
public void postHandle(final HttpServletRequest request, final HttpServletResponse response,
                       final Object handler, final ModelAndView modelAndView) throws Exception {
    if (StringUtils.isNotBlank(request.getQueryString())
            && request.getQueryString().contains(CasProtocolConstants.PARAMETER_TICKET)
            && modelAndView != null) {
        final RedirectView v = new RedirectView(request.getRequestURL().toString());
        v.setExposeModelAttributes(false);
        v.setExposePathVariables(false);
        modelAndView.setView(v);
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:13,代碼來源:CasSecurityContextConfiguration.java

示例5: adaptException2MAV

import org.springframework.web.servlet.ModelAndView; //導入方法依賴的package包/類
private ModelAndView adaptException2MAV(Exception ex) {
    ModelAndView mav = new ModelAndView();
    mav.setView(new MappingJackson2JsonView());
    mav.addObject("exception",ex.getClass().getSimpleName());
    mav.addObject("message", ex.getMessage());
    return mav;
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:8,代碼來源:GlobalExceptionController.java


注:本文中的org.springframework.web.servlet.ModelAndView.setView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。