diff --git a/docs/tutorial.md b/docs/tutorial.md index 51e4edcd..e92a0db0 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -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"; } } ``` @@ -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; } } ``` diff --git a/src/main/java/ch/wisv/events/WebConfiguration.java b/src/main/java/ch/wisv/events/WebConfiguration.java deleted file mode 100644 index 2a3ea9af..00000000 --- a/src/main/java/ch/wisv/events/WebConfiguration.java +++ /dev/null @@ -1,15 +0,0 @@ -package ch.wisv.events; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebConfiguration implements WebMvcConfigurer { - - @Override - public void configurePathMatch(PathMatchConfigurer configurer) { - configurer.setUseTrailingSlashMatch(true); - } - -} \ No newline at end of file diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardCustomerController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardCustomerController.java index c1aefcc2..821b3c63 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardCustomerController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardCustomerController.java @@ -20,7 +20,7 @@ * DashboardCustomerController class. */ @Controller -@RequestMapping(value = "/administrator/customers") +@RequestMapping({"/administrator/customers","/administrator/customers/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardCustomerController extends DashboardController { @@ -49,7 +49,7 @@ public DashboardCustomerController(CustomerService customerService, TicketServic * * @return path to customers index template */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { model.addAttribute(OBJ_CUSTOMERS, customerService.getAllCustomers()); @@ -66,7 +66,7 @@ public String index(Model model) { * * @return path to the customer edit template */ - @GetMapping("/view/{key}") + @GetMapping({"/view/{key}","/view/{key}/"}) public String view(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Customer customer = customerService.getByKey(key); @@ -88,7 +88,7 @@ public String view(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return path to customer create template */ - @GetMapping("/create") + @GetMapping({"/create","/create/"}) public String create(Model model) { if (!model.containsAttribute(OBJ_CUSTOMER)) { model.addAttribute(OBJ_CUSTOMER, new Customer()); @@ -106,7 +106,7 @@ public String create(Model model) { * * @return redirect */ - @PostMapping("/create") + @PostMapping({"/create","/create/"}) public String create(RedirectAttributes redirect, @ModelAttribute Customer model) { try { customerService.create(model); @@ -132,7 +132,7 @@ public String create(RedirectAttributes redirect, @ModelAttribute Customer model * * @return path to the customer edit template */ - @GetMapping("/edit/{key}") + @GetMapping({"/edit/{key}","/edit/{key}/"}) public String edit(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Customer customer = customerService.getByKey(key); @@ -159,7 +159,7 @@ public String edit(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return redirect */ - @PostMapping("/edit/{key}") + @PostMapping({"/edit/{key}","/edit/{key}/"}) public String edit(RedirectAttributes redirect, @ModelAttribute Customer customer, @PathVariable String key) { try { customer.setKey(key); @@ -185,7 +185,7 @@ public String edit(RedirectAttributes redirect, @ModelAttribute Customer custome * * @return redirect */ - @GetMapping("/delete/{key}") + @GetMapping({"/delete/{key}","/delete/{key}/"}) public String delete(RedirectAttributes redirect, @PathVariable String key) { try { Customer customer = customerService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java index 4e76db7f..ba320418 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardEventController.java @@ -37,7 +37,7 @@ * DashboardEventController class. */ @Controller -@RequestMapping(value = "/administrator/events") +@RequestMapping({"/administrator/events","/administrator/events/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardEventController extends DashboardController { @@ -80,7 +80,7 @@ public DashboardEventController( * * @return path to Thymeleaf template */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { model.addAttribute(OBJ_EVENTS, eventService.getAll()); @@ -96,7 +96,7 @@ public String index(Model model) { * * @return String */ - @GetMapping("/view/{key}") + @GetMapping({"/view/{key}","/view/{key}/"}) public String view(Model model, RedirectAttributes redirect, @PathVariable String key) { try { model.addAttribute(OBJ_EVENT, eventService.getByKey(key)); @@ -116,7 +116,7 @@ public String view(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return path to Thymeleaf template */ - @GetMapping("/create") + @GetMapping({"/create","/create/"}) public String create(Model model) { if (!model.containsAttribute(OBJ_EVENT)) { model.addAttribute(OBJ_EVENT, new Event()); @@ -134,7 +134,7 @@ public String create(Model model) { * * @return redirect */ - @PostMapping("/create") + @PostMapping({"/create","/create/"}) public String create(RedirectAttributes redirect, @ModelAttribute Event event, @RequestParam("file") MultipartFile file) { try { if (file.getSize() > 0) { @@ -168,7 +168,7 @@ public String create(RedirectAttributes redirect, @ModelAttribute Event event, @ * * @return path to Thymeleaf template */ - @GetMapping("/edit/{key}") + @GetMapping({"/edit/{key}","/edit/{key}/"}) public String edit(Model model, RedirectAttributes redirect, @PathVariable String key) { try { if (!model.containsAttribute(OBJ_EVENT)) { @@ -193,7 +193,7 @@ public String edit(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return redirect */ - @PostMapping("/edit/{key}") + @PostMapping({"/edit/{key}","/edit/{key}/"}) public String update( RedirectAttributes redirect, @ModelAttribute Event event, @@ -235,7 +235,7 @@ public String update( * * @return String */ - @GetMapping("/overview/{key}") + @GetMapping({"/overview/{key}","/overview/{key}/"}) public String overview(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Event event = eventService.getByKey(key); @@ -257,7 +257,7 @@ public String overview(Model model, RedirectAttributes redirect, @PathVariable S /** * */ - @GetMapping(value = "/overview/csv/{key}", produces = "text/csv") + @GetMapping(value = {"/overview/csv/{key}","/overview/csv/{key}/"}, produces = "text/csv") public HttpEntity csvExport(@PathVariable String key) { try { Event event = eventService.getByKey(key); @@ -299,7 +299,7 @@ public HttpEntity csvExport(@PathVariable String key) { * * @return redirect */ - @GetMapping("/delete/{key}") + @GetMapping({"/delete/{key}","/delete/{key}/"}) public String deleteEvent(RedirectAttributes redirect, @PathVariable String key) { try { Event event = eventService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java index c5a239a6..9f454560 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardIndexController.java @@ -21,7 +21,7 @@ * DashboardController. */ @Controller -@RequestMapping(value = "/administrator") +@RequestMapping({"/administrator","/administrator/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardIndexController extends DashboardController { @@ -57,7 +57,7 @@ public DashboardIndexController( * * @return path to Thymeleaf template */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { List upcomingEvents = this.determineUpcomingEvents(); LocalDateTime CurrentBoardStartYear = this.getCurrentBoardStartDate(); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardOrderController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardOrderController.java index b5725027..da9004a3 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardOrderController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardOrderController.java @@ -20,7 +20,7 @@ * DashboardOrderController class. */ @Controller -@RequestMapping(value = "/administrator/orders") +@RequestMapping({"/administrator/orders","/administrator/orders/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardOrderController extends DashboardController { @@ -57,7 +57,7 @@ public DashboardOrderController( * * @return String */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { model.addAttribute(OBJ_ORDERS, this.orderService.getLimitedOrders()); @@ -73,7 +73,7 @@ public String index(Model model) { * * @return String */ - @GetMapping("/view/{key}") + @GetMapping({"/view/{key}","/view/{key}/"}) public String edit(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); @@ -95,7 +95,7 @@ public String edit(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return String */ - @GetMapping("/delete/{key}") + @GetMapping({"/delete/{key}","/delete/{key}/"}) public String delete(RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); @@ -117,7 +117,7 @@ public String delete(RedirectAttributes redirect, @PathVariable String key) { * * @return String */ - @GetMapping("/resend-confirmation-mail/{key}") + @GetMapping({"/resend-confirmation-mail/{key}","/resend-confirmation-mail/{key}/"}) public String resendConfirmationMail(RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); @@ -140,7 +140,7 @@ public String resendConfirmationMail(RedirectAttributes redirect, @PathVariable * * @return String */ - @GetMapping("/approve/{key}/{payment}") + @GetMapping({"/approve/{key}/{payment}","/approve/{key}/{payment}/"}) public String approve(RedirectAttributes redirect, @PathVariable String key, @PathVariable PaymentMethod payment) { try { Order order = orderService.getByReference(key); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardProductController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardProductController.java index a78e6ded..5854b7ab 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardProductController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardProductController.java @@ -22,7 +22,7 @@ * DashboardProductController. */ @Controller -@RequestMapping("/administrator/products") +@RequestMapping({"/administrator/products","/administrator/products/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardProductController extends DashboardController { @@ -74,7 +74,7 @@ public String index(Model model) { * * @return String */ - @GetMapping("/view/{key}") + @GetMapping({"/view/{key}","/view/{key}"}) public String view(Model model, RedirectAttributes redirect, @PathVariable String key) { try { model.addAttribute(OBJ_PRODUCT, productService.getByKey(key)); @@ -94,7 +94,7 @@ public String view(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return thymeleaf template path */ - @GetMapping("/create") + @GetMapping({"/create","/create/"}) public String create(Model model) { if (!model.containsAttribute(OBJ_PRODUCT)) { model.addAttribute(OBJ_PRODUCT, new Product()); @@ -111,7 +111,7 @@ public String create(Model model) { * * @return redirect */ - @PostMapping("/create") + @PostMapping({"/create","/create/"}) public String create(RedirectAttributes redirect, @ModelAttribute Product product) { try { if (product.getRedirectUrl() != null && product.getRedirectUrl().length() == 0){ @@ -140,7 +140,7 @@ public String create(RedirectAttributes redirect, @ModelAttribute Product produc * * @return thymeleaf template path */ - @GetMapping("/edit/{key}") + @GetMapping({"/edit/{key}","/edit/{key}/"}) public String edit(Model model, RedirectAttributes redirect, @PathVariable String key) { try { if (!model.containsAttribute(OBJ_PRODUCT)) { @@ -164,7 +164,7 @@ public String edit(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return String */ - @PostMapping("/edit/{key}") + @PostMapping({"/edit/{key}","/edit/{key}/"}) public String update(RedirectAttributes redirect, @ModelAttribute Product product, @PathVariable String key) { try { product.setKey(key); @@ -193,7 +193,7 @@ public String update(RedirectAttributes redirect, @ModelAttribute Product produc * * @return String */ - @GetMapping("/overview/{key}") + @GetMapping({"/overview/{key}","/overview/{key}/"}) public String overview(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Product product = productService.getByKey(key); @@ -217,7 +217,7 @@ public String overview(Model model, RedirectAttributes redirect, @PathVariable S * * @return redirect */ - @GetMapping("/delete/{key}") + @GetMapping({"/delete/{key}","/delete/{key}/"}) public String delete(RedirectAttributes redirectAttributes, @PathVariable String key) { try { Product product = productService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java index af9804fc..c20b6f4a 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardSalesExportController.java @@ -31,7 +31,7 @@ * DashboardSalesExportController class. */ @Controller -@RequestMapping("/administrator/salesexport") +@RequestMapping({"/administrator/salesexport","/administrator/salesexport/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardSalesExportController extends DashboardController { @@ -69,7 +69,7 @@ public String index(Model model) { * Exports sales of month to csv * */ - @GetMapping(value="/csv", produces="text/csv") + @GetMapping(value = {"/csv", "/csv"}, produces="text/csv") public HttpEntity csvExport(@ModelAttribute SalesExportSubmission SalesExportSubmission, Model model) { model.addAttribute("SalesExportSubmission", SalesExportSubmission); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardTasksController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardTasksController.java index 6ac203c0..fce7814f 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardTasksController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardTasksController.java @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller -@RequestMapping("/administrator/tasks") +@RequestMapping({"/administrator/tasks","/administrator/tasks/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardTasksController extends DashboardController { @@ -33,7 +33,7 @@ public DashboardTasksController(WebhookTaskService webhookTaskService) { * * @return path to Thymeleaf template location */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { model.addAttribute(OBJ_TASKS, webhookTaskService.getAll()); diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardTreasurerController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardTreasurerController.java index d776035f..c76d18d2 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardTreasurerController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardTreasurerController.java @@ -20,7 +20,7 @@ * DashboardWebhookController class. */ @Controller -@RequestMapping("/administrator/treasurer") +@RequestMapping({"/administrator/treasurer","/administrator/treasurer/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardTreasurerController extends DashboardController { diff --git a/src/main/java/ch/wisv/events/admin/controller/DashboardWebhookController.java b/src/main/java/ch/wisv/events/admin/controller/DashboardWebhookController.java index be0bcf3f..2e59fc9c 100644 --- a/src/main/java/ch/wisv/events/admin/controller/DashboardWebhookController.java +++ b/src/main/java/ch/wisv/events/admin/controller/DashboardWebhookController.java @@ -19,7 +19,7 @@ * DashboardWebhookController class. */ @Controller -@RequestMapping("/administrator/webhooks") +@RequestMapping({"/administrator/webhooks","/administrator/webhooks/"}) @PreAuthorize("hasRole('ADMIN')") public class DashboardWebhookController extends DashboardController { @@ -43,7 +43,7 @@ public DashboardWebhookController(WebhookService webhookService) { * * @return path to Thymeleaf template location */ - @GetMapping() + @GetMapping({"","/"}) public String index(Model model) { model.addAttribute(OBJ_WEBHOOKS, webhookService.getAll()); @@ -59,7 +59,7 @@ public String index(Model model) { * * @return path to Thymeleaf template location */ - @GetMapping("/view/{key}") + @GetMapping({"/view/{key}","/view/{key}/"}) public String view(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Webhook webhook = webhookService.getByKey(key); @@ -80,7 +80,7 @@ public String view(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return path to Thymeleaf template location */ - @GetMapping("/create") + @GetMapping({"/create","/create/"}) public String create(Model model) { if (!model.containsAttribute(OBJ_WEBHOOK)) { model.addAttribute(OBJ_WEBHOOK, new Webhook()); @@ -97,7 +97,7 @@ public String create(Model model) { * * @return redirect to other page */ - @PostMapping("/create") + @PostMapping({"/create","/create/"}) public String create(RedirectAttributes redirect, @ModelAttribute Webhook webhook) { try { webhookService.create(webhook); @@ -121,7 +121,7 @@ public String create(RedirectAttributes redirect, @ModelAttribute Webhook webhoo * * @return path to Thymeleaf template location */ - @GetMapping("/edit/{key}") + @GetMapping({"/edit/{key}","/edit/{key}/"}) public String edit(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Webhook webhook = webhookService.getByKey(key); @@ -144,7 +144,7 @@ public String edit(Model model, RedirectAttributes redirect, @PathVariable Strin * * @return redirect to edit page */ - @PostMapping("/edit/{key}") + @PostMapping({"/edit/{key}","/edit/{key}/"}) public String edit(RedirectAttributes redirect, @ModelAttribute Webhook webhook, @PathVariable String key) { try { webhook.setKey(key); @@ -168,7 +168,7 @@ public String edit(RedirectAttributes redirect, @ModelAttribute Webhook webhook, * * @return redirect to edit page */ - @GetMapping("/delete/{key}") + @GetMapping({"/delete/{key}","/delete/{key}/"}) public String delete(RedirectAttributes redirect, @PathVariable String key) { try { Webhook webhook = webhookService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java b/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java index 4ac83b69..77223c1f 100644 --- a/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/DocumentRestController.java @@ -13,7 +13,7 @@ * DocumentRestController class. */ @RestController -@RequestMapping("/api/v1/documents") +@RequestMapping({"/api/v1/documents","/api/v1/documents/"}) public class DocumentRestController { /** DocumentService. */ @@ -36,7 +36,7 @@ public DocumentRestController(DocumentService documentService) { * @return of type byte[] */ @ResponseBody - @GetMapping(value = "/{name}", produces = MediaType.IMAGE_PNG_VALUE) + @GetMapping(value = {"/{name}","/{name}/"}, produces = MediaType.IMAGE_PNG_VALUE) public byte[] getImagePng(@PathVariable String name) { return this.getDocumentBytes(name); } @@ -49,7 +49,7 @@ public byte[] getImagePng(@PathVariable String name) { * @return of type byte[] */ @ResponseBody - @GetMapping(value = "/{name}", produces = MediaType.IMAGE_JPEG_VALUE) + @GetMapping(value = {"/{name}","/{name}/"}, produces = MediaType.IMAGE_JPEG_VALUE) public byte[] getImageJpeg(@PathVariable String name) { return this.getDocumentBytes(name); } diff --git a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java index 79da0311..d03bcfac 100644 --- a/src/main/java/ch/wisv/events/api/controller/OrderRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/OrderRestController.java @@ -9,7 +9,7 @@ * OrderRestController class. */ @RestController -@RequestMapping("/api/v1/orders") +@RequestMapping({"/api/v1/orders","/api/v1/orders/"}) public class OrderRestController { /** PaymentsService. */ @@ -31,7 +31,7 @@ public OrderRestController(PaymentsService paymentsService) { * * @return Status Message */ - @RequestMapping(value = "/status", method = RequestMethod.POST) + @RequestMapping(value = {"/status","/status/"}, method = RequestMethod.POST) public ResponseEntity updateOrderStatus(@RequestParam(name = "id") String providerReference) { paymentsService.updateStatusByProviderReference(providerReference); return new ResponseEntity<>(HttpStatus.OK); diff --git a/src/main/java/ch/wisv/events/api/controller/ProductRestController.java b/src/main/java/ch/wisv/events/api/controller/ProductRestController.java index cc687837..e3973b6e 100644 --- a/src/main/java/ch/wisv/events/api/controller/ProductRestController.java +++ b/src/main/java/ch/wisv/events/api/controller/ProductRestController.java @@ -25,7 +25,7 @@ * ProductRESTController. */ @RestController -@RequestMapping("/api/v1/products") +@RequestMapping({"/api/v1/products","/api/v1/products/"}) public class ProductRestController { /** @@ -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 productList = productService.getAllProducts(); diff --git a/src/main/java/ch/wisv/events/sales/controller/SalesController.java b/src/main/java/ch/wisv/events/sales/controller/SalesController.java index 5c1fe310..d1c69ef6 100644 --- a/src/main/java/ch/wisv/events/sales/controller/SalesController.java +++ b/src/main/java/ch/wisv/events/sales/controller/SalesController.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller -@RequestMapping(value = "/sales") +@RequestMapping({"/sales","/sales/"}) @PreAuthorize("hasRole('USER')") public class SalesController { diff --git a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanBarcodeController.java b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanBarcodeController.java index cc7afccf..8f5aae4f 100644 --- a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanBarcodeController.java +++ b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanBarcodeController.java @@ -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 { diff --git a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanEventController.java b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanEventController.java index 1d8549b4..2300414e 100644 --- a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanEventController.java +++ b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanEventController.java @@ -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 { @@ -50,7 +50,7 @@ public SalesScanEventController(EventService eventService) { * * @return String */ - @GetMapping("/{method}") + @GetMapping({"/{method}","/{method}/"}) public String scanner(Model model, RedirectAttributes redirect, @PathVariable String key, @PathVariable String method) { try { Event event = eventService.getByKey(key); diff --git a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanMainController.java b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanMainController.java index 32ce2f88..28f33939 100644 --- a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanMainController.java +++ b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanMainController.java @@ -13,7 +13,7 @@ * SalesScanMainController class. */ @Controller -@RequestMapping(value = "/sales/scan") +@RequestMapping({"/sales/scan","/sales/scan/"}) @PreAuthorize("hasRole('USER')") public class SalesScanMainController { diff --git a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanRestController.java b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanRestController.java index 6d9cebc7..7c61defc 100644 --- a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanRestController.java +++ b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanRestController.java @@ -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 { @@ -59,7 +59,7 @@ public SalesScanRestController(EventService eventService, TicketService ticketSe * * @return String */ - @PostMapping("/barcode") + @PostMapping({"/barcode","/barcode/"}) public ResponseEntity barcodeScanner(@PathVariable String key, @RequestParam("barcode") String barcode) { if (barcode.length() != BARCODE_LENGTH) { return createResponseEntity(HttpStatus.BAD_REQUEST, "Invalid EAN 13 barcode length!"); @@ -76,7 +76,7 @@ public ResponseEntity barcodeScanner(@PathVariable String key, @RequestParam("ba * * @return String */ - @PostMapping("/code") + @PostMapping({"/code","/code/"}) public ResponseEntity codeScanner(@PathVariable String key, @RequestParam("code") String code) { if (code.length() != UNIQUE_CODE_UUID_LENGTH && code.length() != UNIQUE_CODE_LEGACY_LENGTH) { return createResponseEntity(HttpStatus.BAD_REQUEST, "Invalid unique code length!"); diff --git a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanTicketController.java b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanTicketController.java index 1b62f223..8aaaad80 100644 --- a/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanTicketController.java +++ b/src/main/java/ch/wisv/events/sales/controller/scan/SalesScanTicketController.java @@ -12,7 +12,7 @@ * SalesScanEventController. */ @Controller -@RequestMapping(value = "/sales/scan/ticket") +@RequestMapping({"/sales/scan/ticket","/sales/scan/ticket/"}) @PreAuthorize("hasRole('USER')") public class SalesScanTicketController { @@ -38,7 +38,7 @@ public class SalesScanTicketController { * * @return String */ - @GetMapping("/error") + @GetMapping({"/error","/error/"}) public String error(Model model) { if (!model.containsAttribute(ATTRIBUTE_ERROR)) { return ERROR_REDIRECT; @@ -59,7 +59,7 @@ public String error(Model model) { * * @return String */ - @GetMapping("/{status}") + @GetMapping({"/{status}","/{status}/"}) public String index(Model model, @PathVariable String status) { ImmutableSet validStatus = ImmutableSet.of("success", "double"); if (!validStatus.contains(status)) { diff --git a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellCustomerController.java b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellCustomerController.java index 04c4a012..28773298 100644 --- a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellCustomerController.java +++ b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellCustomerController.java @@ -25,7 +25,7 @@ */ @Controller @PreAuthorize("hasRole('USER')") -@RequestMapping("/sales/sell/customer/{publicReference}") +@RequestMapping({"/sales/sell/customer/{publicReference}","/sales/sell/customer/{publicReference}/"}) public class SalesSellCustomerController { /** CustomerService. */ @@ -55,7 +55,7 @@ public SalesSellCustomerController( * * @return String */ - @GetMapping("") + @GetMapping({"","/"}) public String identifyCustomer(Model model, RedirectAttributes redirect, @PathVariable String publicReference) { try { Order order = orderService.getByReference(publicReference); @@ -75,7 +75,7 @@ public String identifyCustomer(Model model, RedirectAttributes redirect, @PathVa } } - @PostMapping("") + @PostMapping({"","/"}) public String determineCustomer(RedirectAttributes redirect, @PathVariable String publicReference, @ModelAttribute Customer customer) { Order order; try { @@ -105,7 +105,7 @@ public String determineCustomer(RedirectAttributes redirect, @PathVariable Strin } } - @GetMapping("/create") + @GetMapping({"/create","/create/"}) public String createCustomer(Model model, RedirectAttributes redirect, @PathVariable String publicReference) { try { model.addAttribute(orderService.getByReference(publicReference)); @@ -130,7 +130,7 @@ public String createCustomer(Model model, RedirectAttributes redirect, @PathVari * * @return String */ - @PostMapping("/create") + @PostMapping({"/create","/create/"}) public String create(RedirectAttributes redirect, @ModelAttribute Customer customer, @PathVariable String publicReference) { try { Order order = orderService.getByReference(publicReference); diff --git a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellMainController.java b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellMainController.java index fe56c082..0126d16e 100644 --- a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellMainController.java +++ b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellMainController.java @@ -22,7 +22,7 @@ * SalesSellMainController class. */ @Controller -@RequestMapping(value = "/sales/sell") +@RequestMapping({"/sales/sell","/sales/sell/"}) @PreAuthorize("hasRole('USER')") public class SalesSellMainController { @@ -66,7 +66,7 @@ public SalesSellMainController( * * @return String */ - @GetMapping("") + @GetMapping({"","/"}) public String index(Model model) { Customer currentUser = authenticationService.getCurrentCustomer(); model.addAttribute("products", salesService.getAllGrantedProductByCustomer(currentUser)); @@ -82,7 +82,7 @@ public String index(Model model) { * * @return String */ - @PostMapping("") + @PostMapping({"","/"}) public String createOrder(RedirectAttributes redirect, @ModelAttribute OrderProductDto orderProductDto) { if (orderProductDto.getProducts().isEmpty()) { redirect.addFlashAttribute("error", "Shopping cart can not be empty!"); diff --git a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellOrderController.java b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellOrderController.java index b43c776c..9891e1ef 100644 --- a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellOrderController.java +++ b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellOrderController.java @@ -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. */ @@ -61,7 +61,7 @@ public String overview(Model model, RedirectAttributes redirect, @PathVariable S * * @return String */ - @GetMapping("/{ending}") + @GetMapping({"/{ending}","/{ending}/"}) public String complete(RedirectAttributes redirect, @PathVariable String publicReference, @PathVariable String ending) { try { orderService.getByReference(publicReference); diff --git a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellPaymentController.java b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellPaymentController.java index 3d84297d..0ac62b96 100644 --- a/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellPaymentController.java +++ b/src/main/java/ch/wisv/events/sales/controller/sell/SalesSellPaymentController.java @@ -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. */ diff --git a/src/main/java/ch/wisv/events/sales/controller/stats/SalesStatsController.java b/src/main/java/ch/wisv/events/sales/controller/stats/SalesStatsController.java index 9759c708..927036a4 100644 --- a/src/main/java/ch/wisv/events/sales/controller/stats/SalesStatsController.java +++ b/src/main/java/ch/wisv/events/sales/controller/stats/SalesStatsController.java @@ -24,7 +24,7 @@ * SalesScanEventController. */ @Controller -@RequestMapping(value = "/sales/stats") +@RequestMapping({"/sales/stats","/sales/stats/"}) @PreAuthorize("hasRole('USER')") public class SalesStatsController { /** @@ -82,7 +82,7 @@ public String indexView(Model model) { * @param key of type String * @return String */ - @GetMapping("/products/{key}") + @GetMapping({"/products/{key}","/products/{key}/"}) public String ticketSalesindex(Model model, @PathVariable String key) throws EventNotFoundException { Event event = eventService.getByKey(key); @@ -100,7 +100,7 @@ public String ticketSalesindex(Model model, @PathVariable String key) throws Eve * @param key of type String * @return String */ - @GetMapping("/event/{key}") + @GetMapping({"/event/{key}","/event/{key}/"}) public String eventSalesView(Model model, @PathVariable String key) throws EventNotFoundException { Event event = eventService.getByKey(key); List orders = salesService.getAllOrdersByEvent(event).stream().peek((Order order) -> { diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopCheckoutController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopCheckoutController.java index fb858141..97a565fd 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopCheckoutController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopCheckoutController.java @@ -22,7 +22,7 @@ * WebshopCheckoutController class. */ @Controller -@RequestMapping("/checkout") +@RequestMapping({"/checkout","/checkout/"}) public class WebshopCheckoutController extends WebshopController { /** Error message no products in Order. */ @@ -99,7 +99,7 @@ public String checkoutShoppingBasket(RedirectAttributes redirect, @ModelAttribut * * @return String */ - @GetMapping("/{key}") + @GetMapping({"/{key}","/{key}/"}) public String checkoutOverview(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); @@ -124,7 +124,7 @@ public String checkoutOverview(Model model, RedirectAttributes redirect, @PathVa * * @return String */ - @GetMapping("/{key}/cancel") + @GetMapping({"/{key}/cancel","/{key}/cancel/"}) public String checkoutCancel(RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopCustomerController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopCustomerController.java index 18f96a30..7ff6011c 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopCustomerController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopCustomerController.java @@ -26,7 +26,7 @@ * WebshopCustomerController. */ @Controller -@RequestMapping("/checkout/{key}/customer") +@RequestMapping({"/checkout/{key}/customer","/checkout/{key}/customer/"}) public class WebshopCustomerController extends WebshopController { /** Redirect to the payment page. */ @@ -96,7 +96,7 @@ public String customerOptions(Model model, RedirectAttributes redirect, @PathVar * * @return String */ - @GetMapping("/chconnect") + @GetMapping({"/chconnect","/chconnect/"}) @PreAuthorize("hasRole('USER')") public String customerChConnect(RedirectAttributes redirect, @PathVariable String key) { try { @@ -125,7 +125,7 @@ public String customerChConnect(RedirectAttributes redirect, @PathVariable Strin * * @return String */ - @GetMapping("/guest") + @GetMapping({"/guest","/guest/"}) public String customerGuest(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Order order = orderService.getByReference(key); @@ -155,7 +155,7 @@ public String customerGuest(Model model, RedirectAttributes redirect, @PathVaria * * @return String */ - @PostMapping("/guest") + @PostMapping({"/guest","/guest/"}) public String checkoutGuest(RedirectAttributes redirect, @PathVariable String key, @ModelAttribute Customer customer) { try { Order order = orderService.getByReference(key); diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java index a6c94c3d..62f3a60c 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopIndexController.java @@ -71,7 +71,7 @@ protected WebshopIndexController( * * @return String */ - @GetMapping("/") + @GetMapping({"","/"}) public String index(Model model) { List upcoming = eventService.getUpcoming(); model.addAttribute(MODEL_ATTR_CUSTOMER, authenticationService.getCurrentCustomer()); @@ -90,7 +90,7 @@ public String index(Model model) { * * @return String */ - @GetMapping("/{key}") + @GetMapping({"/{key}","/{key}/"}) public String index(Model model, @PathVariable String key) { try { model.addAttribute(MODEL_ATTR_CUSTOMER, authenticationService.getCurrentCustomer()); diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopOrderOverviewController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopOrderOverviewController.java index 98ad337b..98d54f47 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopOrderOverviewController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopOrderOverviewController.java @@ -16,7 +16,7 @@ * WebshopOrderOverviewController class. */ @Controller -@RequestMapping("/overview") +@RequestMapping({"/overview","/overview/"}) @PreAuthorize("hasAuthority('ROLE_USER')") public class WebshopOrderOverviewController extends WebshopController { diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java index c480ed4a..e675e680 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopPaymentController.java @@ -21,7 +21,7 @@ * WebshopPaymentController class. */ @Controller -@RequestMapping("/checkout/{key}/payment") +@RequestMapping({"/checkout/{key}/payment","/checkout/{key}/payment/"}) public class WebshopPaymentController extends WebshopController { /** Error message order not suitable for checkout. */ @@ -102,7 +102,7 @@ public String paymentOverview(Model model, RedirectAttributes redirect, @PathVar * * @return String string */ - @GetMapping("/reservation") + @GetMapping({"/reservation","/reservation/"}) public String paymentReservation(RedirectAttributes redirect, @PathVariable String key) { try { Order order = this.getOrderAndCheck(key); @@ -124,7 +124,7 @@ public String paymentReservation(RedirectAttributes redirect, @PathVariable Stri * * @return String string */ - @GetMapping("/ideal") + @GetMapping({"/ideal","/ideal/"}) public String paymentIdeal(RedirectAttributes redirect, @PathVariable String key) { return this.payment(redirect, key, PaymentMethod.IDEAL); } @@ -137,7 +137,7 @@ public String paymentIdeal(RedirectAttributes redirect, @PathVariable String key * * @return String string */ - @GetMapping("/sofort") + @GetMapping({"/sofort","/sofort/"}) public String paymentSofort(RedirectAttributes redirect, @PathVariable String key) { return this.payment(redirect, key, PaymentMethod.SOFORT); } diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopReturnController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopReturnController.java index d3d3afff..a9cd07c5 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopReturnController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopReturnController.java @@ -23,7 +23,7 @@ * WebshopReturnController class. */ @Controller -@RequestMapping("/return/{key}") +@RequestMapping({"/return/{key}","/return/{key}/"}) public class WebshopReturnController extends WebshopController { /** diff --git a/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java b/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java index 3e4d05cd..77bb8bde 100644 --- a/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java +++ b/src/main/java/ch/wisv/events/webshop/controller/WebshopTicketController.java @@ -27,7 +27,7 @@ * WebshopOrderOverviewController class. */ @Controller -@RequestMapping("/tickets") +@RequestMapping({"/tickets","/tickets/"}) @PreAuthorize("hasAuthority('ROLE_USER')") public class WebshopTicketController extends WebshopController { /** Model attribute tickets. */ @@ -66,7 +66,7 @@ public WebshopTicketController( * * @return String */ - @GetMapping("/{key}/transfer") + @GetMapping({"/{key}/transfer","/{key}/transfer/"}) public String getTransferPage(Model model, RedirectAttributes redirect, @PathVariable String key) { Customer customer = authenticationService.getCurrentCustomer(); @@ -99,7 +99,7 @@ public String getTransferPage(Model model, RedirectAttributes redirect, @PathVar * * @return String */ - @PostMapping("/{key}/transfer") + @PostMapping({"/{key}/transfer","/{key}/transfer/"}) public String transferTicket(Model model, RedirectAttributes redirect, @PathVariable String key, @RequestParam("email") String email) { Customer currentCustomer = authenticationService.getCurrentCustomer();