Polish templates code

This commit is contained in:
Phillip Webb
2014-04-30 21:17:58 +01:00
parent 1d5cddc1e9
commit decee8d871
11 changed files with 43 additions and 33 deletions

View File

@@ -37,18 +37,18 @@ public class SampleController {
@Autowired
private HelloWorldService helloWorldService;
@RequestMapping(value="/", method=RequestMethod.GET)
@RequestMapping(value = "/", method = RequestMethod.GET)
@ResponseBody
public Map<String, String> hello() {
return Collections.singletonMap("message",
this.helloWorldService.getHelloMessage());
}
@RequestMapping(value="/", method=RequestMethod.POST)
@RequestMapping(value = "/", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> olleh(@Validated Message message) {
Map<String, Object> model = new LinkedHashMap<String, Object>();
model .put("message", message.getValue());
model.put("message", message.getValue());
model.put("title", "Hello Home");
model.put("date", new Date());
return model;
@@ -59,14 +59,14 @@ public class SampleController {
public String foo() {
throw new IllegalArgumentException("Server error");
}
protected static class Message {
@NotBlank(message="Message value cannot be empty")
@NotBlank(message = "Message value cannot be empty")
private String value;
public String getValue() {
return value;
return this.value;
}
public void setValue(String value) {
@@ -74,5 +74,4 @@ public class SampleController {
}
}
}