Issues regarding usage of Spring MVC @RequestMapping methods
Questions tagged [request-mapping]
348 questions
1
vote
1 answer
@RequestParam and @PathVariable on the same variable in Spring Boot
In my Spring boot microservice I need to have dedicated endpoint that maps next urls
/delivery-options/myLabel
/delivery-options?label=myLabel
For handling both I try to use both @RequestParam and @PathVariable for my controller's method parameter…

Vitalii
- 10,091
- 18
- 83
- 151
1
vote
1 answer
Spring Boot - Request Mapping won't accept trailing slash or multiple directories
When RequestMapping in my controller, I'm able to map an html file to "/" and another to "/users". However, trying to map to "/users/" or "/users/test" won't work. In the console it'll say that the endpoint was mapped, but on trying to access it…

Justin Auger
- 11
- 4
1
vote
1 answer
Controller function not getting called on form submit
I have created an form for submission and written a controller method to handle it in spring MVC. But the request is not reaching the controller method.Please let me know what mistake i'm making in writing the controller/form method.
Below is my…

Meenu Dohare
- 11
- 2
1
vote
2 answers
Regex match a string that can contain only characters and numbers
I'm working on Spring @RequestMapping
Let's say I have an URI : /test/{param: REGEX}/something,
or just /test/REGEX/something for non-spring folks.
The REGEX part is where I want to capture any string that can contain only letters and numbers. No…

TheITDejan
- 808
- 9
- 27
1
vote
0 answers
Spring Boot. Method is not being called @RequestMapping(value= "/")
I'm having a problem with my method that maps the localhost:8080/
I created two methods, both call the same jsp page:
@RequestMapping(value = "/index")
public ModelAndView index(ModelAndView modelAndView) {
modelAndView = new…

rpsouza
- 11
- 1
1
vote
1 answer
URL of webservice Get return Null Parameter
I'm using spring MVC to build a simple WebService
This are my classes
1 - Interface
import org.compiere.framework.VO;
import com.audaxis.compiere.api.CompiereAPIApplicationException;
import com.audaxis.erp.service.IBaseService;
public…

zebiri djallil
- 324
- 2
- 6
- 17
1
vote
0 answers
How to add regex for IP address in path variable of a spring boot application?
I am developing a RESTFUL server in spring-boot. For one of the rest endpoint that I am developing, the user will pass IP address as path variable. I want to validate whether the parameter passed contains valid IP address or not. One of the ways…

Dharita Chokshi
- 1,133
- 3
- 16
- 39
1
vote
1 answer
@RequestParam and @PathVariable encapsulation
Is there any way to encapsulate this two values into one object?
public ResponseEntity test(@PathVariable("customerId") String customerId,
@RequestParam(name = "reason", required = true) String reason,
…

pustypawel
- 331
- 2
- 17
1
vote
1 answer
pass abstract parameter to requestMapping function with spring boot
I have an abstract class "Agent"
and 3 other subclasses "Developer", "Support" and "Admin"
Here is the code source of "Agent" :
@Entity
@Table(name = "agents")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "role",…

Mostafa
- 38
- 3
- 10
1
vote
1 answer
Parse input fields as a Array list to controller via @RequestMapping
I want to submit all textfields and radiobuttons from my input fields as an ArrayList and parse it to the controller but I don't know really how.
Any help is really appreciated.
Here's what I tried so far:
@RequestMapping(value = "/formdata", method…

pepote
- 313
- 7
- 21
1
vote
1 answer
GetMapping "produces" works even though doesn't match accept header
Intro
There is a @GetMapping attribute, as the following in one of our projects:
@GetMapping(path = "/", produces = SaConstants.SA_MEDIA_TYPE)
public HttpEntity> get(HttpServletResponse response) {
In the SaConstants class:
public…

Menelaos
- 23,508
- 18
- 90
- 155
1
vote
1 answer
Multiple request mapping on controller Spring Hateos
While in Spring MVC @requestmapping(value={"url1","url2"}) is allowed but Spring HATEOS picks the first mapping while creating link. Is there any solution in which request mapping version on the controller matches with the http request version…

Deepak Gupta
- 197
- 1
- 8
1
vote
2 answers
Missing mappings with @RequestParam variables
Here's my model class:
public class RequestBody {
@JsonProperty("polygon")
private GeoPolygon geoPolygon;
@JsonProperty("domain_id")
private String domainId;
private String availability;
@JsonProperty("start_time")
private String…

Akeshwar Jha
- 4,516
- 8
- 52
- 91
1
vote
1 answer
@RequestMapping & Bound Generic Paramters
The following @RequestMapping's produce an ambiguous request mapping for a @RestController in Spring Boot 1.5/Java 8.
Is there a way to 'negate' the generic constraint on the fist method to not include Iterable's? I would prefer to keep the same…

eztinkerdreams
- 381
- 2
- 3
- 17
1
vote
1 answer
Spring Boot: @RequestMapping Priority
My Spring Boot application encountered a problem as follows:
I have two @RequestMapping:
@RequestMapping(value = "/{categorySlug:^[a-z0-9-]+$}/{slug:^[a-z0-9-]+$}")
public ModelAndView aTutorial(
@PathVariable(value = "categorySlug",…

dta.hoan
- 83
- 6