@@ -556,12 +556,12 @@ application that uses this annotation:
556
556
return appointmentBook.getAppointmentsForToday();
557
557
}
558
558
559
- **@RequestMapping(value= "/{day}", method = RequestMethod.GET)**
559
+ **@RequestMapping(path = "/{day}", method = RequestMethod.GET)**
560
560
public Map<String, Appointment> getForDay(@PathVariable @DateTimeFormat(iso=ISO.DATE) Date day, Model model) {
561
561
return appointmentBook.getAppointmentsForDay(day);
562
562
}
563
563
564
- **@RequestMapping(value= "/new", method = RequestMethod.GET)**
564
+ **@RequestMapping(path = "/new", method = RequestMethod.GET)**
565
565
public AppointmentForm getNewForm() {
566
566
return new AppointmentForm();
567
567
}
@@ -695,7 +695,7 @@ to the value of a URI template variable:
695
695
[source,java,indent=0]
696
696
[subs="verbatim,quotes"]
697
697
----
698
- @RequestMapping(value ="/owners/{ownerId}", method=RequestMethod.GET)
698
+ @RequestMapping(path ="/owners/{ownerId}", method=RequestMethod.GET)
699
699
public String findOwner(**@PathVariable** String ownerId, Model model) {
700
700
Owner owner = ownerService.findOwner(ownerId);
701
701
model.addAttribute("owner", owner);
@@ -717,7 +717,7 @@ template variable by name. You can specify it in the annotation:
717
717
[source,java,indent=0]
718
718
[subs="verbatim,quotes"]
719
719
----
720
- @RequestMapping(value ="/owners/{ownerId}", method=RequestMethod.GET)
720
+ @RequestMapping(path ="/owners/{ownerId}", method=RequestMethod.GET)
721
721
public String findOwner(**@PathVariable("ownerId")** String theOwner, Model model) {
722
722
// implementation omitted
723
723
}
@@ -730,7 +730,7 @@ will match the method argument name to the URI template variable name:
730
730
[source,java,indent=0]
731
731
[subs="verbatim,quotes"]
732
732
----
733
- @RequestMapping(value ="/owners/{ownerId}", method=RequestMethod.GET)
733
+ @RequestMapping(path ="/owners/{ownerId}", method=RequestMethod.GET)
734
734
public String findOwner(**@PathVariable** String ownerId, Model model) {
735
735
// implementation omitted
736
736
}
@@ -742,7 +742,7 @@ A method can have any number of `@PathVariable` annotations:
742
742
[source,java,indent=0]
743
743
[subs="verbatim,quotes"]
744
744
----
745
- @RequestMapping(value ="/owners/{ownerId}/pets/{petId}", method=RequestMethod.GET)
745
+ @RequestMapping(path ="/owners/{ownerId}/pets/{petId}", method=RequestMethod.GET)
746
746
public String findPet(**@PathVariable** String ownerId, **@PathVariable** String petId, Model model) {
747
747
Owner owner = ownerService.findOwner(ownerId);
748
748
Pet pet = owner.getPet(petId);
@@ -886,7 +886,7 @@ Below is an example of extracting the matrix variable "q":
886
886
----
887
887
// GET /pets/42;q=11;r=22
888
888
889
- @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET)
889
+ @RequestMapping(path = "/pets/{petId}", method = RequestMethod.GET)
890
890
public void findPet(@PathVariable String petId, @MatrixVariable int q) {
891
891
892
892
// petId == 42
@@ -903,10 +903,10 @@ specific to identify where the variable is expected to be:
903
903
----
904
904
// GET /owners/42;q=11/pets/21;q=22
905
905
906
- @RequestMapping(value = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET)
906
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET)
907
907
public void findPet(
908
- @MatrixVariable(value ="q", pathVar="ownerId") int q1,
909
- @MatrixVariable(value ="q", pathVar="petId") int q2) {
908
+ @MatrixVariable(name ="q", pathVar="ownerId") int q1,
909
+ @MatrixVariable(name ="q", pathVar="petId") int q2) {
910
910
911
911
// q1 == 11
912
912
// q2 == 22
@@ -921,7 +921,7 @@ A matrix variable may be defined as optional and a default value specified:
921
921
----
922
922
// GET /pets/42
923
923
924
- @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET)
924
+ @RequestMapping(path = "/pets/{petId}", method = RequestMethod.GET)
925
925
public void findPet(@MatrixVariable(required=false, defaultValue="1") int q) {
926
926
927
927
// q == 1
@@ -936,7 +936,7 @@ All matrix variables may be obtained in a Map:
936
936
----
937
937
// GET /owners/42;q=11;r=12/pets/21;q=22;s=23
938
938
939
- @RequestMapping(value = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET)
939
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}", method = RequestMethod.GET)
940
940
public void findPet(
941
941
@MatrixVariable Map<String, String> matrixVars,
942
942
@MatrixVariable(pathVar="petId"") Map<String, String> petMatrixVars) {
@@ -994,7 +994,7 @@ media type. For example:
994
994
[subs="verbatim,quotes"]
995
995
----
996
996
@Controller
997
- @RequestMapping(value = "/pets", method = RequestMethod.POST, **consumes="application/json"**)
997
+ @RequestMapping(path = "/pets", method = RequestMethod.POST, **consumes="application/json"**)
998
998
public void addPet(@RequestBody Pet pet, Model model) {
999
999
// implementation omitted
1000
1000
}
@@ -1024,7 +1024,7 @@ condition. For example:
1024
1024
[subs="verbatim,quotes"]
1025
1025
----
1026
1026
@Controller
1027
- @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, **produces="application/json"**)
1027
+ @RequestMapping(path = "/pets/{petId}", method = RequestMethod.GET, **produces="application/json"**)
1028
1028
@ResponseBody
1029
1029
public Pet getPet(@PathVariable String petId, Model model) {
1030
1030
// implementation omitted
@@ -1057,7 +1057,7 @@ example with a request parameter value condition:
1057
1057
@RequestMapping("/owners/{ownerId}")
1058
1058
public class RelativePathUriTemplateController {
1059
1059
1060
- @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, **params="myParam=myValue"**)
1060
+ @RequestMapping(path = "/pets/{petId}", method = RequestMethod.GET, **params="myParam=myValue"**)
1061
1061
public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {
1062
1062
// implementation omitted
1063
1063
}
@@ -1075,7 +1075,7 @@ specific request header value:
1075
1075
@RequestMapping("/owners/{ownerId}")
1076
1076
public class RelativePathUriTemplateController {
1077
1077
1078
- @RequestMapping(value = "/pets", method = RequestMethod.GET, **headers="myHeader=myValue"**)
1078
+ @RequestMapping(path = "/pets", method = RequestMethod.GET, **headers="myHeader=myValue"**)
1079
1079
public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {
1080
1080
// implementation omitted
1081
1081
}
@@ -1302,7 +1302,7 @@ The following code snippet shows the usage:
1302
1302
1303
1303
Parameters using this annotation are required by default, but you can specify that a
1304
1304
parameter is optional by setting ++@RequestParam++'s `required` attribute to `false`
1305
- (e.g., `@RequestParam(value ="id", required=false)`).
1305
+ (e.g., `@RequestParam(path ="id", required=false)`).
1306
1306
1307
1307
Type conversion is applied automatically if the target method parameter type is not
1308
1308
`String`. See <<mvc-ann-typeconversion>>.
@@ -1320,7 +1320,7 @@ be bound to the value of the HTTP request body. For example:
1320
1320
[source,java,indent=0]
1321
1321
[subs="verbatim,quotes"]
1322
1322
----
1323
- @RequestMapping(value = "/something", method = RequestMethod.PUT)
1323
+ @RequestMapping(path = "/something", method = RequestMethod.PUT)
1324
1324
public void handle(@RequestBody String body, Writer writer) throws IOException {
1325
1325
writer.write(body);
1326
1326
}
@@ -1399,7 +1399,7 @@ response body (and not placed in a Model, or interpreted as a view name). For ex
1399
1399
[source,java,indent=0]
1400
1400
[subs="verbatim,quotes"]
1401
1401
----
1402
- @RequestMapping(value = "/something", method = RequestMethod.PUT)
1402
+ @RequestMapping(path = "/something", method = RequestMethod.PUT)
1403
1403
@ResponseBody
1404
1404
public String helloWorld() {
1405
1405
return "Hello World";
@@ -1546,7 +1546,7 @@ form field individually.
1546
1546
[source,java,indent=0]
1547
1547
[subs="verbatim,quotes"]
1548
1548
----
1549
- @RequestMapping(value= "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1549
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1550
1550
public String processSubmit(**@ModelAttribute Pet pet**) { }
1551
1551
----
1552
1552
@@ -1568,7 +1568,7 @@ using an URI template variable and a type converter. Here is an example:
1568
1568
[source,java,indent=0]
1569
1569
[subs="verbatim,quotes"]
1570
1570
----
1571
- @RequestMapping(value= "/accounts/{account}", method = RequestMethod.PUT)
1571
+ @RequestMapping(path = "/accounts/{account}", method = RequestMethod.PUT)
1572
1572
public String save(@ModelAttribute("account") Account account) {
1573
1573
1574
1574
}
@@ -1593,7 +1593,7 @@ following the `@ModelAttribute` argument:
1593
1593
[source,java,indent=0]
1594
1594
[subs="verbatim,quotes"]
1595
1595
----
1596
- @RequestMapping(value= "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1596
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1597
1597
public String processSubmit(**@ModelAttribute("pet") Pet pet**, BindingResult result) {
1598
1598
1599
1599
if (result.hasErrors()) {
@@ -1617,7 +1617,7 @@ subsequently reported back to the user:
1617
1617
[source,java,indent=0]
1618
1618
[subs="verbatim,quotes"]
1619
1619
----
1620
- @RequestMapping(value= "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1620
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1621
1621
public String processSubmit(**@ModelAttribute("pet") Pet pet**, BindingResult result) {
1622
1622
1623
1623
new PetValidator().validate(pet, result);
@@ -1636,7 +1636,7 @@ annotation:
1636
1636
[source,java,indent=0]
1637
1637
[subs="verbatim,quotes"]
1638
1638
----
1639
- @RequestMapping(value= "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1639
+ @RequestMapping(path = "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
1640
1640
public String processSubmit(**@Valid @ModelAttribute("pet") Pet pet**, BindingResult result) {
1641
1641
1642
1642
if (result.hasErrors()) {
@@ -1956,7 +1956,7 @@ the view class or interface to be used:
1956
1956
@RestController
1957
1957
public class UserController {
1958
1958
1959
- @RequestMapping(value = "/user", method = RequestMethod.GET)
1959
+ @RequestMapping(path = "/user", method = RequestMethod.GET)
1960
1960
@JsonView(User.WithoutPasswordView.class)
1961
1961
public User getUser() {
1962
1962
return new User("eric", "7!jd#h23");
@@ -2008,7 +2008,7 @@ to the model:
2008
2008
@Controller
2009
2009
public class UserController extends AbstractController {
2010
2010
2011
- @RequestMapping(value = "/user", method = RequestMethod.GET)
2011
+ @RequestMapping(path = "/user", method = RequestMethod.GET)
2012
2012
public String getUser(Model model) {
2013
2013
model.addAttribute("user", new User("eric", "7!jd#h23"));
2014
2014
model.addAttribute(JsonView.class.getName(), User.WithoutPasswordView.class);
@@ -2758,7 +2758,7 @@ through `Model` nor `RedirectAttributes`. For example:
2758
2758
[source,java,indent=0]
2759
2759
[subs="verbatim,quotes"]
2760
2760
----
2761
- @RequestMapping(value = "/files/{path}", method = RequestMethod.POST)
2761
+ @RequestMapping(path = "/files/{path}", method = RequestMethod.POST)
2762
2762
public String upload(...) {
2763
2763
// ...
2764
2764
return "redirect:files/{path}";
@@ -2936,7 +2936,7 @@ application/atom+xml is shown below.
2936
2936
2937
2937
private List<SampleContent> contentList = new ArrayList<SampleContent>();
2938
2938
2939
- @RequestMapping(value ="/content", method=RequestMethod.GET)
2939
+ @RequestMapping(path ="/content", method=RequestMethod.GET)
2940
2940
public ModelAndView getContent() {
2941
2941
ModelAndView mav = new ModelAndView();
2942
2942
mav.setViewName("content");
@@ -3542,7 +3542,7 @@ use `MultipartHttpServletRequest` or `MultipartFile` in the method parameters:
3542
3542
@Controller
3543
3543
public class FileUploadController {
3544
3544
3545
- @RequestMapping(value = "/form", method = RequestMethod.POST)
3545
+ @RequestMapping(path = "/form", method = RequestMethod.POST)
3546
3546
public String handleFormUpload(@RequestParam("name") String name,
3547
3547
@RequestParam("file") MultipartFile file) {
3548
3548
@@ -3571,7 +3571,7 @@ the method parameter:
3571
3571
@Controller
3572
3572
public class FileUploadController {
3573
3573
3574
- @RequestMapping(value = "/form", method = RequestMethod.POST)
3574
+ @RequestMapping(path = "/form", method = RequestMethod.POST)
3575
3575
public String handleFormUpload(@RequestParam("name") String name,
3576
3576
@RequestParam("file") Part file) {
3577
3577
@@ -3629,7 +3629,7 @@ multipart:
3629
3629
[source,java,indent=0]
3630
3630
[subs="verbatim,quotes"]
3631
3631
----
3632
- @RequestMapping(value= "/someUrl", method = RequestMethod.POST)
3632
+ @RequestMapping(path = "/someUrl", method = RequestMethod.POST)
3633
3633
public String onSubmit(**@RequestPart("meta-data") MetaData metadata,
3634
3634
@RequestPart("file-data") MultipartFile file**) {
3635
3635
@@ -3840,7 +3840,7 @@ When writing error information, the status code and the error message set on the
3840
3840
@Controller
3841
3841
public class ErrorController {
3842
3842
3843
- @RequestMapping(value ="/error", produces="application/json")
3843
+ @RequestMapping(path ="/error", produces="application/json")
3844
3844
@ResponseBody
3845
3845
public Map<String, Object> handle(HttpServletRequest request) {
3846
3846
0 commit comments