JAVA-1529: Spring MVC @PathVariable with a dot (.) gets truncated
This commit is contained in:
parent
87b4ea1d0d
commit
34c18aefc4
@ -2,3 +2,4 @@
|
||||
|
||||
- [Cache Headers in Spring MVC](https://www.baeldung.com/spring-mvc-cache-headers)
|
||||
- [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters)
|
||||
- [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot)
|
@ -1,4 +1,4 @@
|
||||
package com.baeldung.spring.web.config;
|
||||
package com.baeldung.pathvariable;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
@ -1,27 +1,29 @@
|
||||
package com.baeldung.web.controller;
|
||||
package com.baeldung.pathvariable;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.RequestMethod;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/site")
|
||||
public class SiteController {
|
||||
|
||||
@RequestMapping(value = "/{firstValue}/{secondValue}", method = RequestMethod.GET)
|
||||
@GetMapping("/{firstValue}/{secondValue}")
|
||||
public String requestWithError(@PathVariable("firstValue") String firstValue,
|
||||
@PathVariable("secondValue") String secondValue) {
|
||||
|
||||
return firstValue + " - " + secondValue;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{firstValue}/{secondValue:.+}", method = RequestMethod.GET)
|
||||
@GetMapping("/{firstValue}/{secondValue:.+}")
|
||||
public String requestWithRegex(@PathVariable("firstValue") String firstValue,
|
||||
@PathVariable("secondValue") String secondValue) {
|
||||
|
||||
return firstValue + " - " + secondValue;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{firstValue}/{secondValue}/", method = RequestMethod.GET)
|
||||
@GetMapping("/{firstValue}/{secondValue}/")
|
||||
public String requestWithSlash(@PathVariable("firstValue") String firstValue,
|
||||
@PathVariable("secondValue") String secondValue) {
|
||||
|
@ -13,6 +13,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
- [Introduction to HtmlUnit](https://www.baeldung.com/htmlunit)
|
||||
- [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files)
|
||||
- [web.xml vs Initializer with Spring](https://www.baeldung.com/spring-xml-vs-java-config)
|
||||
- [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot)
|
||||
- [A Java Web Application Without a web.xml](https://www.baeldung.com/java-web-app-without-web-xml)
|
||||
- [Accessing Spring MVC Model Objects in JavaScript](https://www.baeldung.com/spring-mvc-model-objects-js)
|
||||
|
Loading…
x
Reference in New Issue
Block a user