How to change Spring MVC's behavior in handling url 'dot' character

前端 未结 6 636
耶瑟儿~
耶瑟儿~ 2020-12-06 11:40

I\'m trying to migrate a web project off from Jersey to Spring MVC 3.0. The process was really straightforward up to the moment when I started to migrate the controllers sup

6条回答
  •  甜味超标
    2020-12-06 12:13

    This was a bitch. A guy on our team here got it to work over the weekend. We were going to go with underscore but he got it. He removed @Controller from the controller class attributes and left @RequestMapping blank for the class. On the public methods for Http get and put he added "/2.0/" to the @RequestMapping. Example below.

    @RequestMapping
    public class EndpointController {
    
    @RequestMapping(value="/2.0/endpoint", method = RequestMethod.POST,
    consumes=MediaType.APPLICATION_JSON_VALUE, produces=MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity create( @Valid @RequestBody EndpointView endpointParams, HttpServletRequest request )
    

    Good luck everyone. This problem sucked.

提交回复
热议问题