Announcement Announcement Module
Collapse
No announcement yet.
@PathVariable not resolving Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @PathVariable not resolving

    Spring Community,
    I have an issue that appears to have been asked before, but not resolved. I have of course done my due diligence. However, I can't find the answer.

    Why does the following never resolve when I perform a PUT on the URL?

    Code:
    @RequestMapping(value = "/sensor/add/{name}/{type}/{location}", method=RequestMethod.PUT,produces = "application/json")
    	public @ResponseBody
    	ResponseEntity<String> test(@PathVariable("name") String name,
    			@PathVariable("type") String type, 
    			@PathVariable("location") String location, 
    			HttpServletRequest request,
    			HttpServletResponse response) {
    		HttpHeaders headers = new HttpHeaders();
    		headers.add("Content-Type", "application/json");
    		System.err.println("Made it: " + name + " " + type + " ");
    
    		return new ResponseEntity<String>(headers, HttpStatus.ACCEPTED);
    	}
    Using the URL "http://localhost:8080/ABServer/sensor/add/testname/testtype/testlocation" spring mvc does not resolve the URL, but instead goes to the Index page.

    In addition, if I remove the "location" variable, it works just fine (Much the same as the previously unanswered question). I've read the appropriate documentation and do not see a limit to the number of variables. In addition, the URL is certainly unique.

    Thoughts? What am I missing?

    Thanks

  • #2
    Hello

    What happen if you use RequestMethod.GET or RequestMethod.POST?

    Comment

    Working...
    X