List of usage examples for org.springframework.web.servlet.mvc.method.annotation MvcUriComponentsBuilder fromMethodCall
public static UriComponentsBuilder fromMethodCall(Object info)
From source file:su90.mybatisdemo.utils.UriUtils.java
public static URI generateUri(Object info) { UriComponents uriComponents = MvcUriComponentsBuilder.fromMethodCall(info).build(); return uriComponents.encode().toUri(); }
From source file:su90.mybatisdemo.utils.UriUtils.java
public static String generateAsciiStr(Object info) { UriComponents uriComponents = MvcUriComponentsBuilder.fromMethodCall(info).build(); return uriComponents.encode().toUri().toASCIIString(); }
From source file:su90.mybatisdemo.utils.UriUtils.java
public static Href generateHref(Object info) { UriComponents uriComponents = MvcUriComponentsBuilder.fromMethodCall(info).build(); return new Href(uriComponents.encode().toUri().toASCIIString()); }
From source file:com.training.rest.api.BookController.java
@RequestMapping(value = "/books", method = RequestMethod.POST) public ResponseEntity<Void> addBook(@RequestBody Book book) { Book saved = bookService.save(book); URI location = MvcUriComponentsBuilder.fromMethodCall(on(BookController.class).getBook(saved.getId())) .build().toUri();/* www . ja v a 2 s . c om*/ return ResponseEntity.created(location).build(); }