-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement
Description
Michael Osipov opened SPR-16910 and commented
Consider the following snippet:
import java.io.InputStream;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
@RestController
@RequestMapping("/rest/documents")
public class DocumentsController {
@PostMapping(consumes = "application/zip")
public ResponseEntity<?> createDocument(InputStream is, UriComponentsBuilder uriBuilder) {
UriComponents uc = uriBuilder.path("/rest/documents/{id}").buildAndExpand("6667f88a-5783-11e8-857e-001f29e7988e");
return ResponseEntity.created(uc.toUri()).build();
}
}Unfortunately, I have to duplicate /rest/documents with the UriComponentsBuilder. It'd be nice if this components could be controller mapping relative. I'd like to do uriBuilder.path("/{id}").buildAndExpand("6667f88a-5783-11e8-857e-001f29e7988e") only.
Affects: 5.0.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement