/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
spring-web-modules/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable.dottruncated/SiteController.java
32 строки
1 KB
Amit Pandey
[JAVA-30357] Upgrade spring-mvc-java-2 to Spring Boot 3 (#15625)
22 янв 2024, 11:00
Не верифицирован
22 янв 2024, 11:00
97e9ba0
Код
Авторство
О чём код?
package com.baeldung.pathvariable.dottruncated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/site") public class SiteController { @GetMapping("/{firstValue}/{secondValue}") public String requestWithError(@PathVariable("firstValue") String firstValue, @PathVariable("secondValue") String secondValue) { return firstValue + " - " + secondValue; } @GetMapping("/{firstValue}/{secondValue:.+}") public String requestWithRegex(@PathVariable("firstValue") String firstValue, @PathVariable("secondValue") String secondValue) { return firstValue + " - " + secondValue; } @GetMapping("/{firstValue}/{secondValue}/") public String requestWithSlash(@PathVariable("firstValue") String firstValue, @PathVariable("secondValue") String secondValue) { return firstValue + " - " + secondValue; } }