public ResponseBuilder initialize(final Resource parent, final Resource child) {
        if (MISSING_RESOURCE.equals(parent)) {
            // Can't POST to a missing resource
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(parent)) {
            // Can't POST to a deleted resource
            throw new ClientErrorException(GONE);
        } else if (ACL.equals(getRequest().getExt())
                || ldpResourceTypes(parent.getInteractionModel()).noneMatch(LDP.Container::equals)) {
            // Can't POST to an ACL resource or non-Container
            throw new NotAllowedException(GET, Stream.of(HEAD, OPTIONS, PATCH, PUT, DELETE).toArray(String[]::new));
        } else if (!MISSING_RESOURCE.equals(child) && !DELETED_RESOURCE.equals(child)) {
            throw new ClientErrorException(CONFLICT);
        } else if (!supportsInteractionModel(ldpType)) {
            throw new BadRequestException("Unsupported interaction model provided", status(BAD_REQUEST)
                .link(UnsupportedInteractionModel.getIRIString(), LDP.constrainedBy.getIRIString()).build());
        } else if (ldpType.equals(LDP.NonRDFSource) && rdfSyntax != null) {
            LOGGER.error("Cannot save {} as a NonRDFSource with RDF syntax", getIdentifier());
            throw new BadRequestException("Cannot save resource as a NonRDFSource with RDF syntax");
        }

        setParent(parent);
        return status(CREATED);
    }
public ResponseBuilder initialize ( final Resource parent , final Resource child ) { if ( MISSING_RESOURCE . equals ( parent ) ) { throw new NotFoundException ( ) ; } else if ( DELETED_RESOURCE . equals ( parent ) ) { throw new ClientErrorException ( GONE ) ; } else if ( ACL . equals ( getRequest ( ) . getExt ( ) ) || ldpResourceTypes ( parent . getInteractionModel ( ) ) . noneMatch ( LDP . Container :: equals ) ) { throw new NotAllowedException ( GET , Stream . of ( HEAD , OPTIONS , PATCH , PUT , DELETE ) . toArray ( String [ ] :: new ) ) ; } else if ( ! MISSING_RESOURCE . equals ( child ) && ! DELETED_RESOURCE . equals ( child ) ) { throw new ClientErrorException ( CONFLICT ) ; } else if ( ! supportsInteractionModel ( ldpType ) ) { throw new BadRequestException ( "Unsupported interaction model provided" , status ( BAD_REQUEST ) . link ( UnsupportedInteractionModel . getIRIString ( ) , LDP . constrainedBy . getIRIString ( ) ) . build ( ) ) ; } else if ( ldpType . equals ( LDP . NonRDFSource ) && rdfSyntax != null ) { LOGGER . error ( "Cannot save {} as a NonRDFSource with RDF syntax" , getIdentifier ( ) ) ; throw new BadRequestException ( "Cannot save resource as a NonRDFSource with RDF syntax" ) ; } setParent ( parent ) ; return status ( CREATED ) ; }
Initialize the response.
@param parent the parent resource
@param child the child resource
@return a response builder