2

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<String,String> startParams)

How do i send the startParams from the url?

All my tries ends up with:

IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found

Also it is not possible to send empty like

theurl/start/

it gives

dec 18, 2015 10:56:07 FM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI

Is it somehow possible to send no params, or do i need a separate method for that?:

Xstian
  • 8,184
  • 10
  • 42
  • 72
Viktor Mellgren
  • 4,318
  • 3
  • 42
  • 75
  • Check this answer: http://stackoverflow.com/questions/18280395/passing-a-mapstring-string-to-a-springmvc-controller – user987339 Dec 18 '15 at 10:10

1 Answers1

1

You have to use @MatrixVariable instead of @PathVariable.

have a look at this example Spring Matrix variable usage

Lovababu Padala
  • 2,415
  • 2
  • 20
  • 28