use of org.springframework.web.method.HandlerMethod in project spring-framework by spring-projects.
the class ModelFactoryTests method modelAttributeWithBindingDisabled.
@Test
public void modelAttributeWithBindingDisabled() throws Exception {
ModelFactory modelFactory = createModelFactory("modelAttrWithBindingDisabled");
HandlerMethod handlerMethod = createHandlerMethod("handle");
modelFactory.initModel(this.webRequest, this.mavContainer, handlerMethod);
assertTrue(this.mavContainer.containsAttribute("foo"));
assertTrue(this.mavContainer.isBindingDisabled("foo"));
}
use of org.springframework.web.method.HandlerMethod in project spring-framework by spring-projects.
the class ModelFactoryTests method sessionAttribute.
@Test
public void sessionAttribute() throws Exception {
this.attributeStore.storeAttribute(this.webRequest, "sessionAttr", "sessionAttrValue");
ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
HandlerMethod handlerMethod = createHandlerMethod("handle");
modelFactory.initModel(this.webRequest, this.mavContainer, handlerMethod);
assertEquals("sessionAttrValue", this.mavContainer.getModel().get("sessionAttr"));
}
use of org.springframework.web.method.HandlerMethod in project spring-framework by spring-projects.
the class ModelFactoryTests method modelAttributeFromSessionWithBindingDisabled.
@Test
public void modelAttributeFromSessionWithBindingDisabled() throws Exception {
Foo foo = new Foo();
this.attributeStore.storeAttribute(this.webRequest, "foo", foo);
ModelFactory modelFactory = createModelFactory("modelAttrWithBindingDisabled");
HandlerMethod handlerMethod = createHandlerMethod("handle");
modelFactory.initModel(this.webRequest, this.mavContainer, handlerMethod);
assertTrue(this.mavContainer.containsAttribute("foo"));
assertSame(foo, this.mavContainer.getModel().get("foo"));
assertTrue(this.mavContainer.isBindingDisabled("foo"));
}
use of org.springframework.web.method.HandlerMethod in project spring-framework by spring-projects.
the class ModelFactoryTests method modelAttributeMethodWithNameByConvention.
@Test
public void modelAttributeMethodWithNameByConvention() throws Exception {
ModelFactory modelFactory = createModelFactory("modelAttrConvention");
HandlerMethod handlerMethod = createHandlerMethod("handle");
modelFactory.initModel(this.webRequest, this.mavContainer, handlerMethod);
assertEquals(Boolean.TRUE, this.mavContainer.getModel().get("boolean"));
}
use of org.springframework.web.method.HandlerMethod in project spring-framework by spring-projects.
the class RequestMappingInfoHandlerMappingTests method getHandlerBestMatch.
@Test
public void getHandlerBestMatch() throws Exception {
Method expected = on(TestController.class).annot(getMapping("/foo").params("p")).resolveMethod();
ServerWebExchange exchange = get("/foo?p=anything").toExchange();
HandlerMethod hm = (HandlerMethod) this.handlerMapping.getHandler(exchange).block();
assertEquals(expected, hm.getMethod());
}
Aggregations