@PathVariable

spring 2018. 3. 21. 15:52

 

- interceptor에서 사용시

final Map<String, String> pathVariables = (Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);


https://gist.github.com/ankushs92/0e97e070401a1bb5fe55



- Controller에서 사용(@PathVariable == @PathParam)

@RequestMapping(value = "/{variable}", method = RequestMethod.GET)
public String companyPath(@PathVariable("variable") String pathUrl, Model model)


@RequestMapping(value = "/{variable}", method = RequestMethod.GET)
public String companyPath(@PathVariable String variable, Model model)


- pathvariable 값에 dot(.)이 표함된 경우

  /somepath/{variable:.+} 와 같이 사용


  http://winmargo.tistory.com/202

 

 

Posted by 張's blog
,