Search code examples
javaspringrequest-mapping

How to map all requests to single controller method in spring?


I am new to spring. I want to map all the requests to single controller method. That's why I have specified following requestmapping

@RequestMapping
(
  value="/PnPanel.go/CData/**", 
  method={RequestMethod.GET, RequestMethod.POST}
)

But still it's giving 404 error, when URL is requested

http://localhost:8088/PnPanel.go/CData/invokeCDScreen

Don't know, what I am missing here. I tried searching on net, but all the solutions didn't work for me.

Thanks in advance.


Solution

  • Actually, I had solved it myself. I was missing the following thing :-

    @RequestMapping
    (
      value="/PnPanel.go/CData/*", 
      method={RequestMethod.GET, RequestMethod.POST}
    )
    

    Thus, instead of using two asterisks, only one was required.