本文整理汇总了Java中org.springframework.webflow.execution.RequestContextHolder.setRequestContext方法的典型用法代码示例。如果您正苦于以下问题:Java RequestContextHolder.setRequestContext方法的具体用法?Java RequestContextHolder.setRequestContext怎么用?Java RequestContextHolder.setRequestContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.webflow.execution.RequestContextHolder
的用法示例。
在下文中一共展示了RequestContextHolder.setRequestContext方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyGetServiceThemeDoesNotExist
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceThemeDoesNotExist() {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setTheme("myTheme");
r.setId(1000);
r.setName("Test Service");
r.setServiceId("myServiceId");
this.servicesManager.save(r);
final MockHttpServletRequest request = new MockHttpServletRequest();
final RequestContext ctx = mock(RequestContext.class);
final MutableAttributeMap scope = new LocalAttributeMap();
scope.put("service", org.jasig.cas.services.TestUtils.getService(r.getServiceId()));
when(ctx.getFlowScope()).thenReturn(scope);
RequestContextHolder.setRequestContext(ctx);
request.addHeader("User-Agent", "Mozilla");
assertEquals("test", this.serviceThemeResolver.resolveThemeName(request));
}
示例2: verifyGetServiceWithTheme
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceWithTheme() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
final WebApplicationService webApplicationService = new WebApplicationServiceFactory().createService("myServiceId");
requestContext.getFlowScope().put("service", webApplicationService);
final ResourceLoader loader = mock(ResourceLoader.class);
final Resource resource = mock(Resource.class);
when(resource.exists()).thenReturn(true);
when(loader.getResource(anyString())).thenReturn(resource);
this.registeredServiceThemeBasedViewResolver.setResourceLoader(loader);
assertEquals("/WEB-INF/view/jsp/myTheme/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例3: verifyGetServiceThemeDoesNotExist
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceThemeDoesNotExist() {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setTheme("myTheme");
r.setId(1000);
r.setName("Test Service");
r.setServiceId("myServiceId");
this.servicesManager.save(r);
final MockHttpServletRequest request = new MockHttpServletRequest();
final RequestContext ctx = mock(RequestContext.class);
final MutableAttributeMap scope = new LocalAttributeMap();
scope.put("service", TestUtils.getService(r.getServiceId()));
when(ctx.getFlowScope()).thenReturn(scope);
RequestContextHolder.setRequestContext(ctx);
request.addHeader("User-Agent", "Mozilla");
assertEquals("test", this.serviceThemeResolver.resolveThemeName(request));
}
示例4: verifyGetServiceThemeDoesNotExist
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceThemeDoesNotExist() {
final RegexRegisteredService r = new RegexRegisteredService();
r.setTheme("myTheme");
r.setId(1000);
r.setName("Test Service");
r.setServiceId("myServiceId");
this.servicesManager.save(r);
final MockHttpServletRequest request = new MockHttpServletRequest();
final RequestContext ctx = mock(RequestContext.class);
final MutableAttributeMap scope = new LocalAttributeMap();
scope.put("service", RegisteredServiceTestUtils.getService(r.getServiceId()));
when(ctx.getFlowScope()).thenReturn(scope);
RequestContextHolder.setRequestContext(ctx);
request.addHeader(WebUtils.USER_AGENT_HEADER, MOZILLA);
assertEquals(DEFAULT_THEME_NAME, this.serviceThemeResolver.resolveThemeName(request));
}
示例5: verifyGetServiceWithDefault
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceWithDefault() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
final WebApplicationService webApplicationService = new WebApplicationServiceFactory().createService("myDefaultId");
requestContext.getFlowScope().put("service", webApplicationService);
assertEquals("/WEB-INF/view/jsp/default/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例6: verifyNoService
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyNoService() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
assertEquals("/WEB-INF/view/jsp/default/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例7: verifyGetServiceWithTheme
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceWithTheme() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
final WebApplicationService webApplicationService = new SimpleWebApplicationServiceImpl("myServiceId");
requestContext.getFlowScope().put("service", webApplicationService);
assertEquals("/WEB-INF/view/jsp/myTheme/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例8: verifyGetServiceWithDefault
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceWithDefault() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
final WebApplicationService webApplicationService = new SimpleWebApplicationServiceImpl("myDefaultId");
requestContext.getFlowScope().put("service", webApplicationService);
assertEquals("/WEB-INF/view/jsp/defaultTheme/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例9: verifyNoService
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyNoService() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
assertEquals("/WEB-INF/view/jsp/defaultTheme/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:RegisteredServiceThemeBasedViewResolverTests.java
示例10: before
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Before
public void before() {
final RequestContext ctx = mock(RequestContext.class);
when(ctx.getConversationScope()).thenReturn(new LocalAttributeMap<>());
WebUtils.putAuthentication(CoreAuthenticationTestUtils.getAuthentication(), ctx);
RequestContextHolder.setRequestContext(ctx);
}
示例11: verifyGetServiceWithTheme
import org.springframework.webflow.execution.RequestContextHolder; //导入方法依赖的package包/类
@Test
public void verifyGetServiceWithTheme() throws Exception {
final MockRequestContext requestContext = new MockRequestContext();
RequestContextHolder.setRequestContext(requestContext);
final WebApplicationService webApplicationService = new WebApplicationServiceFactory().createService("myServiceId");
requestContext.getFlowScope().put("service", webApplicationService);
assertEquals("/WEB-INF/view/jsp/myTheme/ui/casLoginView",
this.registeredServiceThemeBasedViewResolver.buildView("casLoginView").getUrl());
}