@ POST @ Timed public void createResource ( @ Suspended final AsyncResponse response , @ Context final Request request , @ Context final UriInfo uriInfo , @ Context final HttpHeaders headers , @ Context final SecurityContext secContext , final InputStream body ) { final TrellisRequest req = new TrellisRequest ( request , uriInfo , headers , secContext ) ; final String urlBase = getBaseUrl ( req ) ; final String path = req . getPath ( ) ; final String identifier = getIdentifier ( req ) ; final String separator = path . isEmpty ( ) ? "" : "/" ; final IRI parent = rdf . createIRI ( TRELLIS_DATA_PREFIX + path ) ; final IRI child = rdf . createIRI ( TRELLIS_DATA_PREFIX + path + separator + identifier ) ; final PostHandler postHandler = new PostHandler ( req , parent , identifier , body , trellis , urlBase ) ; trellis . getResourceService ( ) . get ( parent ) . thenCombine ( trellis . getResourceService ( ) . get ( child ) , postHandler :: initialize ) . thenCompose ( postHandler :: createResource ) . thenCompose ( postHandler :: updateMemento ) . thenApply ( ResponseBuilder :: build ) . exceptionally ( this :: handleException ) . thenApply ( response :: resume ) ; }
Perform a POST operation on a LDP Resource .