Questions tagged [request-mapping]

Issues regarding usage of Spring MVC @RequestMapping methods

348 questions
2
votes
1 answer

Can multiple classes have RequestMapping("/") if their method RequestMappings don't conflict?

If you have two classes, both with "" (nothing) mapped to the class level, and there are several @RequestMapping annotated methods in each, but none of the methods' mappings conflict with each other, will it work? If not, how could you achieve the…
David Neuschulz
  • 113
  • 1
  • 8
2
votes
1 answer

Abstract class and url mapping

I have an abstract class I try to have all generic method in this class. I get issue about mapping. public abstract class BaseControllerNew { ... @GetMapping(value = "/{id}") …
robert trudel
  • 5,283
  • 17
  • 72
  • 124
2
votes
2 answers

How can I map URL containing colon to my Spring controller?

I want to map a URL (for example, http://example.com/v1/books:search) containing colons to my Spring MVC controller, but I can't make it work. @RequestMapping("/v1/books") public class BooksController { @GetMapping(":search") public Page
Bourne Xi
  • 111
  • 1
  • 6
2
votes
1 answer

What is String:.+ in spring request mapping's path param

While I was modifying the code written by other developer I come across an end point @RequestMapping(value = "/ICD/{icdcode:.+} and wanted to know what is :.+ in the path variable.
user09
  • 920
  • 2
  • 12
  • 38
2
votes
1 answer

Spring Boot @RequestMapping Inheritance

since I need to serve two APIs which controllers are very similar in most of all cases and therefore I'd like to work with abstract controllers and sub controllers in order to achieve routes like: /sym/products /frontend/products Where the "sym" or…
DrumTim
  • 101
  • 3
  • 11
2
votes
1 answer

How to send request from AngularJS controller to Spring Controller?

I am making SPA using AngularJS in Spring 4 with Hibernate 5. I can't send a request from the AngularJS controller to the Spring Controller. execution coming inside submit() function successfully, but it's going fail. Error shows in browser…
user2298828
2
votes
0 answers

@RequestMapping with multiple URL qualifying

Thanks for your reply.Let me rephrase the question again.Suppose if there are two @ RequestMapping qualifying for different controller then how it works below is the code. @Controller @RequestMapping(/user/*) public class MyController{ //some…
2
votes
1 answer

how to apply user defined properties value to @RequestMapping

I have several @RequestMapping which value will subject to change from "/XXX" to "/V100" on someday. So I need to define it in properties. I've googled and there's way using application.properties but I have to keep "/XXX" value in a user defined…
JustinB
  • 45
  • 7
2
votes
1 answer

Rest path for application

I'm fairly new to Spring Boot, but I want to want to build my application in such a way, that can deploy mulitple applications on the same server and i want to distinguish the applications in the rest path. For example, say i have the applications…
Urr4
  • 611
  • 9
  • 26
2
votes
1 answer

Spring MVC 4.3 404 error. Path mapping issue. Servlet Mapping and Configuration looks fine

AppInitailizer.java public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer{ @Override protected Class[] getRootConfigClasses() { return new Class[]{AppConfig.class}; } @Override protected Class[]…
2
votes
1 answer

Migrate from JAX-RS @Path to Spring MVC @RequestMapping using regex

I'm trying to migrate code from Jax-Rs (jersey implementation) to a Spring MVC entry point: jax-rs: @GET @Path("{bundle}/bundle{min: (-min)*}.{extension: js|css}") public Response getBundle(@PathParam("bundle") String bundle, @PathParam("min")…
herau
  • 1,466
  • 2
  • 18
  • 36
2
votes
3 answers

How to know which param of @RequestMapping is called

This is my @RequestMapping annotation: @RequestMapping({"/loginBadCredentials", "/loginUserDisabled", "/loginUserNumberExceeded"}) public String errorLogin(...){ ... } Inside the method errorLogin , is there a way…
MDP
  • 4,177
  • 21
  • 63
  • 119
2
votes
1 answer

Spring MVC 4.2.4 / Controller with RequestMapping("/**") and static resources

I have an angular application which uses ui-router, and is served by a SpringMvc (4.2.4) java app. I decided to map any requests to a single Controller/method which loads the single JSP page of my project. But, When I try to add static resources…
Djamon44
  • 31
  • 4
2
votes
1 answer

@PathVariable Map syntax for url?

I have a controller which looks like @RequestMapping(value = "/start/{params}", method = GET, produces = { APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE }) String doStart(@PathVariable("params") Map startParams) How do i send the…
Viktor Mellgren
  • 4,318
  • 3
  • 42
  • 75
2
votes
1 answer

RequestMapping: path is undefined

I'm referencing this Spring doc and trying to bind data to my view. I wanted to request map my controller to, say /act1 and a method to doohickey.do so the complete path will be /act1/doohickey.do. However, Eclipse says The attribute path is…
Ascendant
  • 827
  • 2
  • 16
  • 34