Skip to content

Commit

Permalink
Add trailing slashes to requests with ...Mapping(value= ..)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepdeJong committed May 20, 2024
1 parent 49dca5f commit 14bd310
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Lets say you want to create two pages on paths `/events/example/page-1` and on `

```java
@Controller
@RequestMapping(value = "/events/example")
@RequestMapping({"/events/example","/events/example/"})
public class MyController {

@RequestMapping(value= "/page-1")
@RequestMapping({"/page-1","/page-1/"})
public String handlePageOne() { return "page 1"; }

@RequestMapping(value= "/page-2")
@RequestMapping({"/page-2","/page-2/"})
public String handlePageTwo() { return "page 2"; }
}
```
Expand All @@ -46,10 +46,10 @@ Or you could uses a `@PathVariable` which makes a part of the Path variable whic

```java
@Controller
@RequestMapping(value = "/events/example")
@RequestMapping({"/events/example","/events/example/"})
public class MyController {

@RequestMapping(value= "/{page}")
@RequestMapping({"/{page}","/{page}/"})
public String handleBothPages(@PathVariable String page) { return page; }
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* DashboardCustomerController class.
*/
@Controller
@RequestMapping(value = "/administrator/customers")
@RequestMapping({"/administrator/customers","/administrator/customers/"})
@PreAuthorize("hasRole('ADMIN')")
public class DashboardCustomerController extends DashboardController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* DashboardEventController class.
*/
@Controller
@RequestMapping(value = "/administrator/events")
@RequestMapping({"/administrator/events","/administrator/events/"})
@PreAuthorize("hasRole('ADMIN')")
public class DashboardEventController extends DashboardController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* DashboardController.
*/
@Controller
@RequestMapping(value = "/administrator")
@RequestMapping({"/administrator","/administrator/"})
@PreAuthorize("hasRole('ADMIN')")
public class DashboardIndexController extends DashboardController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* DashboardOrderController class.
*/
@Controller
@RequestMapping(value = "/administrator/orders")
@RequestMapping({"/administrator/orders","/administrator/orders/"})
@PreAuthorize("hasRole('ADMIN')")
public class DashboardOrderController extends DashboardController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public ResponseEntity createProduct(@Validated @RequestBody ProductDto product)
*
* @return Search Object
*/
@GetMapping(value = "/search/unused")
@GetMapping({"/search/unused","/search/unused/"})
@PreAuthorize("hasRole('ADMIN')")
public Search getSearchProducts(@RequestParam(value = "query", required = false) String query) {
List<Product> productList = productService.getAllProducts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "/sales")
@RequestMapping({"/sales","/sales/"})
@PreAuthorize("hasRole('USER')")
public class SalesController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* SalesScanEventController.
*/
@Controller
@RequestMapping(value = "/sales/scan/barcode/{uniqueCode}")
@RequestMapping({"/sales/scan/barcode/{uniqueCode}","/sales/scan/barcode/{uniqueCode}/"})
@PreAuthorize("hasRole('USER')")
public class SalesScanBarcodeController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* SalesScanEventController.
*/
@Controller
@RequestMapping(value = "/sales/scan/event/{key}")
@RequestMapping({"/sales/scan/event/{key}","/sales/scan/event/{key}/"})
@PreAuthorize("hasRole('USER')")
public class SalesScanEventController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* SalesScanMainController class.
*/
@Controller
@RequestMapping(value = "/sales/scan")
@RequestMapping({"/sales/scan","/sales/scan/"})
@PreAuthorize("hasRole('USER')")
public class SalesScanMainController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* SalesScanRestController.
*/
@RestController
@RequestMapping(value = "/api/v1/sales/scan/event/{key}")
@RequestMapping({"/api/v1/sales/scan/event/{key}","/api/v1/sales/scan/event/{key}/"})
@PreAuthorize("hasRole('USER')")
public class SalesScanRestController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* SalesScanEventController.
*/
@Controller
@RequestMapping(value = "/sales/scan/ticket")
@RequestMapping({"/sales/scan/ticket","/sales/scan/ticket/"})
@PreAuthorize("hasRole('USER')")
public class SalesScanTicketController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SalesSellMainController class.
*/
@Controller
@RequestMapping(value = "/sales/sell")
@RequestMapping({"/sales/sell","/sales/sell/"})
@PreAuthorize("hasRole('USER')")
public class SalesSellMainController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
@Controller
@PreAuthorize("hasRole('USER')")
@RequestMapping(value = "/sales/sell/order/{publicReference}")
@RequestMapping({"/sales/sell/order/{publicReference}","/sales/sell/order/{publicReference}/"})
public class SalesSellOrderController {

/** OrderService. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@Controller
@PreAuthorize("hasRole('USER')")
@RequestMapping(value = "/sales/sell/payment/{publicReference}")
@RequestMapping({"/sales/sell/payment/{publicReference}","/sales/sell/payment/{publicReference}/"})
public class SalesSellPaymentController {

/** OrderService. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* SalesScanEventController.
*/
@Controller
@RequestMapping(value = "/sales/stats")
@RequestMapping({"/sales/stats","/sales/stats/"})
@PreAuthorize("hasRole('USER')")
public class SalesStatsController {
/**
Expand Down

0 comments on commit 14bd310

Please sign in to comment.