Questions tagged [request-mapping]

Issues regarding usage of Spring MVC @RequestMapping methods

348 questions
1
vote
2 answers

Spring RequestMapping DELETE and unauthorized access JWT

I have a problem with DELETE method in spring. I'm using JWT and sending it in request header but GET/POST/PATCH works, DELETE don't..I don't really know why. Even via postman I'm not authorized 401 to delete item but I can get/patch/post a new…
1
vote
0 answers

There was an unexpected error (type=Not Found, status=404). No message available even if have added componentScan request is not directed

There was an unexpected error (type=Not Found, status=404). No message available I couldn't find what is wrong with this code. URL:localhost:8080/home pom.xml My pom.xml
1
vote
2 answers

Spring MVC passes null value on next page

I am a beginner in SpringMVC JSP and I am creating a simple project that passes values using POST Method. 1st page: hello.jsp

Record Form

Name:

MAC
  • 676
  • 3
  • 13
  • 32
1
vote
3 answers

web.xml url-pattern is not resolving wildcards

I am running simple Spring MVC application. In web.xml, I used following mapping configuration: spring-web
John Smith
  • 401
  • 6
  • 17
1
vote
1 answer

Regex to match empty or any string except a specific string for request mapping

I need to do a request mapping for an URL, which would match an empty string, or any string except a specific string after a forward slash character: /. The below regex matches any string after /, and ignores the specific string "resources", but it…
user1614862
  • 3,701
  • 7
  • 29
  • 46
1
vote
1 answer

@PathVariable with slashes in middle of RequestMapping URL

I have a Spring controller mapping like following: @RequestMapping(value = "api/{pathVar1}/receipt", method = RequestMethod.POST) @ResponseBody public String generateReceipt(HttpServletRequest request, @PathVariable String pathVar1) { .... } In…
gpsingh
  • 11
  • 3
1
vote
0 answers

Calling @GetMapping "/" on external tomcat throws error - Spring Boot

I developed a spring boot application and deployed on external tomcat. What I am facing is when I call application through context path tomcat throws an exception. Controller @GetMapping(value="/", produces = "text/html;charset=UTF-8") public…
sadia
  • 305
  • 1
  • 7
  • 18
1
vote
1 answer

RequestMapping inheritence between class level and method level

Given the @Controller below, even if i send a Get Request to the webApp, the controller run the homePage method. @RestController @RequestMapping(method = RequestMethod.POST) public class MyController { @GetMapping("/hello") public…
xmen-5
  • 1,806
  • 1
  • 23
  • 44
1
vote
1 answer

Spring: Annotate a method with both @RequestMapping and @ExceptionHandler?

I recently stumbled upon some code that I had not seen in this form before. Maybe someone here can help me understand better what's going on. Namely, I found a method annotated both with @RequestMapping and @ExceptionHandler. I thought that the…
Malte Skoruppa
  • 1,232
  • 1
  • 19
  • 25
1
vote
1 answer

Searching for data from database does not search the term in java?

So, my problem is I have a api I am creating an I am getting data from database. So, when I do GET localhost:8080/myapp/jobs?autocomplete=0120 (which 0120 is the full value of the jobs code to show that data, which it does show that data). But, when…
user11626167
1
vote
2 answers

What is the best way to implement a REST service that query the database using like statement using Spring Boot and JPA?

I want to query database for the items that are similar(sql like) to the given string which is later is going to be used for auto complete feature in my app. I want to use REST services but I wondering what is the best approach to implement it. I am…
1
vote
1 answer

Controller does not recieve data from jsp page

I have sent data from jsp page to controller. It shows error. The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. This is my controller:::: @GetMapping(value =…
OUN Saif
  • 305
  • 1
  • 4
  • 20
1
vote
1 answer

403 - Forbidden error for a Request Mapping in Spring MVC

I am writing a simple Spring MVC Controller with a few basic Request Mappings as follows. @Controller public class UserController { @RequestMapping("/showReg") public String showRegistration() { return "login/registerUser"; …
1
vote
1 answer

Browser URL error in Spring MVC request mapping

Please do not reject this question as I have gone through many related questions and couldn't find the specific problem I am trying to solve. Pardom me for any shortcomings in the post as I have only started to post questions. I am facing an issue…
arunken
  • 415
  • 3
  • 15
1
vote
1 answer

Multiple Spring @RequestMapping headers

my question is very simple, It's possibily use two different content-type headers on the same method? like that: @RequestMapping(value = "/provider", method = RequestMethod.POST, headers = "Accept=application/json,content-type=multipart/form-data") …
AlejoDev
  • 4,345
  • 9
  • 36
  • 67