本文整理汇总了Java中org.springframework.web.servlet.ModelAndView.getModel方法的典型用法代码示例。如果您正苦于以下问题:Java ModelAndView.getModel方法的具体用法?Java ModelAndView.getModel怎么用?Java ModelAndView.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.ModelAndView
的用法示例。
在下文中一共展示了ModelAndView.getModel方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOK
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void testOK() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final OAuth20WrapperController oauth20WrapperController = new OAuth20WrapperController();
oauth20WrapperController.afterPropertiesSet();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + "?" + OAuthConstants.CODE + "=" + SERVICE_TICKET, map.get("callbackUrl"));
}
示例2: verifyOK
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void verifyOK() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + '?' + OAuthConstants.CODE + '=' + SERVICE_TICKET, map.get("callbackUrl"));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:OAuth20CallbackAuthorizeControllerTests.java
示例3: verifyOKWithState
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void verifyOKWithState() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockSession.putValue(OAuthConstants.OAUTH20_STATE, STATE);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + '?' + OAuthConstants.CODE + '=' + SERVICE_TICKET + '&' + OAuthConstants.STATE + '='
+ STATE, map.get("callbackUrl"));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:OAuth20CallbackAuthorizeControllerTests.java
示例4: verifyOK
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void verifyOK() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final OAuth20WrapperController oauth20WrapperController = new OAuth20WrapperController();
oauth20WrapperController.afterPropertiesSet();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + "?" + OAuthConstants.CODE + "=" + SERVICE_TICKET, map.get("callbackUrl"));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:OAuth20CallbackAuthorizeControllerTests.java
示例5: verifyOKWithState
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void verifyOKWithState() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockSession.putValue(OAuthConstants.OAUTH20_STATE, STATE);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final OAuth20WrapperController oauth20WrapperController = new OAuth20WrapperController();
oauth20WrapperController.afterPropertiesSet();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + "?" + OAuthConstants.CODE + "=" + SERVICE_TICKET + "&" + OAuthConstants.STATE + "="
+ STATE, map.get("callbackUrl"));
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:OAuth20CallbackAuthorizeControllerTests.java
示例6: testOKWithState
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void testOKWithState() throws Exception {
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(
"GET",
CONTEXT
+ OAuthConstants.CALLBACK_AUTHORIZE_URL);
mockRequest.addParameter(OAuthConstants.TICKET, SERVICE_TICKET);
final MockHttpSession mockSession = new MockHttpSession();
mockSession.putValue(OAuthConstants.OAUTH20_CALLBACKURL, REDIRECT_URI);
mockSession.putValue(OAuthConstants.OAUTH20_SERVICE_NAME, SERVICE_NAME);
mockSession.putValue(OAuthConstants.OAUTH20_STATE, STATE);
mockRequest.setSession(mockSession);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final OAuth20WrapperController oauth20WrapperController = new OAuth20WrapperController();
oauth20WrapperController.afterPropertiesSet();
final ModelAndView modelAndView = oauth20WrapperController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuthConstants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> map = modelAndView.getModel();
assertEquals(SERVICE_NAME, map.get("serviceName"));
assertEquals(REDIRECT_URI + "?" + OAuthConstants.CODE + "=" + SERVICE_TICKET + "&" + OAuthConstants.STATE + "="
+ STATE, map.get("callbackUrl"));
}
示例7: handlerLoginLog
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
/**
* 处理登陆日志
* @param joinPoint
* @param proceed
*/
private void handlerLoginLog(ProceedingJoinPoint joinPoint,Object proceed) {
Signature signature = joinPoint.getSignature();
//是登陆操作
if(signature.getDeclaringTypeName().equals("com.lovecws.mumu.system.controller.system.index.SysLoginController")&&signature.getName().equals("logining")){
//登陆成功
if(proceed instanceof ModelAndView){
ModelAndView modelAndView=(ModelAndView)proceed;
Map<String, Object> model = modelAndView.getModel();
Object code = model.get("code");
if(code!=null&&"200".equals(code.toString())){
messageHandler.handler();
}
}
}
}
示例8: doGet
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Override
protected ModelAndView doGet(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) {
ModelAndView modelAndView = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("editProfile.jsp"));
Map<String, Object> model = modelAndView.getModel();
model.put("testConnectionUrl", myPath + "?testConnection=true");
model.put("namespaceChooserUrl", myKubeNamespaceChooserController.getUrl());
model.put("deploymentChooserUrl", myKubeDeploymentChooserController.getUrl());
model.put("deleteImageUrl", myKubeDeleteImageDialogController.getUrl());
final String projectId = httpServletRequest.getParameter("projectId");
final List<AgentPool> pools = new ArrayList<>();
if (!BuildProject.ROOT_PROJECT_ID.equals(projectId)){
pools.add(AgentPoolUtil.DUMMY_PROJECT_POOL);
}
pools.addAll(myAgentPoolManager.getProjectOwnedAgentPools(projectId));
model.put("agentPools", pools);
model.put("authStrategies", myAuthStrategyProvider.getAll());
model.put("podTemplateProviders", myPodTemplateProviders.getAll());
return modelAndView;
}
示例9: verifyRedirectToApproval
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
@Test
public void verifyRedirectToApproval() throws Exception {
clearAllServices();
final MockHttpServletRequest mockRequest = new MockHttpServletRequest(GET, CONTEXT
+ OAuth20Constants.AUTHORIZE_URL);
mockRequest.setParameter(OAuth20Constants.CLIENT_ID, CLIENT_ID);
mockRequest.setParameter(OAuth20Constants.REDIRECT_URI, REDIRECT_URI);
mockRequest.setParameter(OAuth20Constants.RESPONSE_TYPE, OAuth20ResponseTypes.CODE.name().toLowerCase());
mockRequest.setServerName(CAS_SERVER);
mockRequest.setServerPort(CAS_PORT);
mockRequest.setScheme(CAS_SCHEME);
final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
final OAuthRegisteredService service = getRegisteredService(REDIRECT_URI, SERVICE_NAME);
service.setBypassApprovalPrompt(false);
this.servicesManager.save(service);
final CasProfile profile = new CasProfile();
profile.setId(ID);
final Map<String, Object> attributes = new HashMap<>();
attributes.put(FIRST_NAME_ATTRIBUTE, FIRST_NAME);
attributes.put(LAST_NAME_ATTRIBUTE, LAST_NAME);
profile.addAttributes(attributes);
final MockHttpSession session = new MockHttpSession();
mockRequest.setSession(session);
session.putValue(Pac4jConstants.USER_PROFILES, profile);
final ModelAndView modelAndView = oAuth20AuthorizeEndpointController.handleRequest(mockRequest, mockResponse);
assertEquals(OAuth20Constants.CONFIRM_VIEW, modelAndView.getViewName());
final Map<String, Object> model = modelAndView.getModel();
assertEquals(CommonHelper.addParameter(AUTHORIZE_URL, OAuth20Constants.BYPASS_APPROVAL_PROMPT, "true"), model.get("callbackUrl"));
assertEquals(SERVICE_NAME, model.get("serviceName"));
}
示例10: parseMenu
import org.springframework.web.servlet.ModelAndView; //导入方法依赖的package包/类
private Collection<MenuItem> parseMenu(HttpServletRequest request, ModelAndView modelAndView, Collection<MenuItem> items) {
Map<String, Object> sourceMap = modelAndView.getModel();
final String[] search = new String[sourceMap.size()];
final String[] replace = new String[sourceMap.size()];
int i = 0;
for (Map.Entry<String, Object> entry : sourceMap.entrySet()) {
search[i] = String.format("${%s}", entry.getKey());
replace[i++] = String.valueOf(entry.getValue());
}
items = parseItem(request, search, replace, items);
return items;
}