Questions tagged [request-mapping]

Issues regarding usage of Spring MVC @RequestMapping methods

348 questions
2
votes
1 answer

Spring: REST-Controller cannot be found by SpringBootApplication

I'm building a Spring-REST-API with CRUD-functionality to create, read, update and delete books with a MongoDB-database. My project has the following structure: BackendBookLibraryApplication.java in main > java >…
2
votes
1 answer

Feign call URL with comma

I'm trying to call a URL with commas, curly braces and square brackets in it. With Feign, here is how I begin : @FeignClient(name="FinancialTimesFeignClient", url="https://markets.ft.com/data/equities/ajax/updateScreenerResults") public interface…
Samuel
  • 594
  • 1
  • 6
  • 22
2
votes
1 answer

Java handle invalid request Mapping urls including decodings

in my apiController, I have @Controller @RequestMapping("api/v1/myservice") @Slf4j public class APIController { @RequestMapping(value = "/validAPI1", method = RequestMethod.GET) @ResponseBody public String validAPI1() { return…
user2751691
  • 401
  • 2
  • 10
  • 32
2
votes
2 answers

How to rewrite URLs with Spring (Boot) via REST Controllers?

Let's say I have the following controller with its parent class: @RestController public class BusinessController extends RootController { @GetMapping(value = "users", produces = {"application/json"}) @ResponseBody public String users()…
2
votes
2 answers

How to set priority to Spring-Boot request mapping methods

I have a Spring-Boot (v2.0.2) application with a RestController with 2 methods which only differ by the Accept header. A simplified version of the code is this: @RestController @RequestMapping("/myapp") public class FooController { …
2
votes
2 answers

Spring Boot/Java Mapping Enum Values to RequestParam

I have an Enum like below public enum Customer { RETAIL("retail"), FREELANCER("FreeLancer"), MARKET("market"), PUBLICATION("publication"); private String contentType; private static final Map
Lucie
  • 127
  • 1
  • 2
  • 12
2
votes
1 answer

How to define a default handler in Spring Boot 2

How can I define a default handler, or controller action, that will be invoked when no other handler is found for a given URL? I tried by using a catch-all pattern /** (syntax is Kotlin): @Controller class DefaultController { …
Tobia
  • 17,856
  • 6
  • 74
  • 93
2
votes
1 answer

Spring WebFlux Controller Mapping Issues -Double Wildcard

I'm in a Spring WebFlux context and i'm trying to use the double wildcard mapping feature. As the documentation says…
2
votes
2 answers

Spring static content(css) not served properly (spring boot)

I have a spring boot app and a controller that server static webpage(React build): @Controller @RequestMapping("/test") public class HomeController { @GetMapping("/") public String index() { return "index.html"; } ... index.html is…
Roie Beck
  • 1,113
  • 3
  • 15
  • 30
2
votes
4 answers

GET/POST Requst to REST API using Spring Boot

I have a REST Service an external server like https://api.myrestservice.com and I have a Spring Boot Application running locally on http://localhost:8080. Now I want to make GET or POST request to the REST API address i.e…
Vijesh
  • 795
  • 3
  • 9
  • 23
2
votes
2 answers

Spring boot get application properties per request mapping

I try to get per request some parameters from my application properties. My ApplicationConfig-Class: @Configuration @ConfigurationProperties("org.a.b") public class ApplicationConfig implements Serializable { private String name; private…
emoleumassi
  • 4,881
  • 13
  • 67
  • 93
2
votes
2 answers

Spring @RequestMapping "Not Contains" Regex

I have this RequestMapping: @RequestMapping(value = "/route/to-{destination}-from-{departure}.html", method = {RequestMethod.GET, RequestMethod.HEAD}) And I would like to add that RequestMapping: @RequestMapping(value =…
AddJ
  • 63
  • 7
2
votes
1 answer

Request Mappings, leave out specific cases instead of catching all

Introduction We have has created a request mapping as the following: @RequestMapping(path = "/{project}/{resource}/{language}", method = RequestMethod.GET) public ResponseEntity get( @PathVariable String project, …
Menelaos
  • 23,508
  • 18
  • 90
  • 155
2
votes
1 answer

Spring-boot rest api. Truncate trailing slash

I have a spring-boot rest api. In my application.properties I have: server.port=8100 server.contextPath=/api/users There's a controller: @RestController @RequestMapping("") public class UserService { @RequestMapping(value = "", method = POST,…
htshame
  • 6,599
  • 5
  • 36
  • 56
2
votes
2 answers

In spring, how about if PathVariable contains RequestMapping value

If I want to create a basic controller with RequestMapping = "/{content}" to handle the general case. But for some specific contents, I want to create a concrete controller for this special case, and inherit from that basic controller. For…
cxlove
  • 71
  • 1
  • 1
  • 3