Add support for controller base path on BasePathAwareController / RepositoryRestController.
This commit introduces support for a common base path shared amongst all handler methods of a controller annotated with @BasePathAwareController / @RepositoryRestController. Related ticket: #2087 Original pull request: #2088.
This commit is contained in:
committed by
Oliver Drotbohm
parent
71ae98132c
commit
c73d3816a6
@@ -58,10 +58,10 @@ public class JpaRepositoryConfig extends JpaInfrastructureConfig {
|
||||
void someMethod(@PathVariable String id) {}
|
||||
}
|
||||
|
||||
@RepositoryRestController
|
||||
@RepositoryRestController(path = {"orders", "orders/v2"})
|
||||
static class OrdersJsonController {
|
||||
|
||||
@RequestMapping(value = "/orders/search/sort", method = RequestMethod.POST, produces = "application/hal+json")
|
||||
@RequestMapping(value = {"/search/sort","/search/sorted"}, method = RequestMethod.POST, produces = "application/hal+json")
|
||||
void someMethodWithArgs(Sort sort, Pageable pageable, DefaultedPageable defaultedPageable) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,10 +702,13 @@ public class JpaWebTests extends CommonWebTests {
|
||||
andExpect(client.hasLinkWithRel(IanaLinkRelations.SELF));
|
||||
}
|
||||
|
||||
@Test // DATAREST-910
|
||||
@Test // DATAREST-910 DATAREST-2088
|
||||
void callUnmappedCustomRepositoryController() throws Exception {
|
||||
|
||||
mvc.perform(post("/orders/v3/search/sort")).andExpect(status().isNotFound());
|
||||
mvc.perform(post("/orders/search/sort")).andExpect(status().isOk());
|
||||
mvc.perform(post("/orders/search/sorted")).andExpect(status().isOk());
|
||||
mvc.perform(post("/orders/v2/search/sort")).andExpect(status().isOk());
|
||||
mvc.perform(post("/orders/v2/search/sorted")).andExpect(status().isOk());
|
||||
mvc.perform(post("/orders/search/sort?sort=type&page=1&size=10")).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user