public ResponseBuilder initialize ( final Resource parent , final Resource resource ) { setResource ( DELETED_RESOURCE . equals ( resource ) || MISSING_RESOURCE . equals ( resource ) ? null : resource ) ; // Check the cache if ( getResource ( ) != null ) { final Instant modified = getResource ( ) . getModified ( ) ; final EntityTag etag ; if ( getResource ( ) . getBinaryMetadata ( ) . isPresent ( ) && ! isRdfType ( getRequest ( ) . getContentType ( ) ) ) { etag = new EntityTag ( buildEtagHash ( getIdentifier ( ) + "BINARY" , modified , null ) ) ; } else { etag = new EntityTag ( buildEtagHash ( getIdentifier ( ) , modified , getRequest ( ) . getPrefer ( ) ) ) ; } // Check the cache checkRequiredPreconditions ( preconditionRequired , getRequest ( ) . getHeaders ( ) . getFirst ( IF_MATCH ) , getRequest ( ) . getHeaders ( ) . getFirst ( IF_UNMODIFIED_SINCE ) ) ; checkCache ( modified , etag ) ; } // One cannot put binaries into the ACL graph if ( ACL . equals ( getRequest ( ) . getExt ( ) ) && rdfSyntax == null ) { throw new NotAcceptableException ( ) ; } // For operations that modify resources, the parent resource may need to be updated via // ResourceService::touch. This allows us to keep a reference to the parent resource // since it has already been looked up. However, access to the parent resource is not necessary // if, in the case of creation/deletion, PUT operations are configured as 'uncontained' (the default) // or, in the case of updates, the resource has no parent container. // Here, the `resource` object is used directly rather than doing a null check on `getResource()` since // in this case, they amount to the same thing. if ( ! createUncontained || resource . getContainer ( ) . isPresent ( ) ) { setParent ( parent ) ; } return status ( NO_CONTENT ) ; }
Initialize the response handler .