src/main/java/org/trellisldp/http/PartitionedLdpResource.java
/**
     * Perform a POST operation on a LDP Resource
     * @param req the request
     * @param body the body
     * @return the response
     */
Perform a POST operation on a LDP Resource
@param req the request
@param body the body
@return the response
Perform a POST operation on a LDP Resource @param req the request @param body the body @return the response
@POST
    @Timed
    public Response createResource(@BeanParam final LdpRequest req, final File body) {
        final String baseUrl = partitions.get(req.getPartition());
        final String path = req.getPartition() + req.getPath();
        final String identifier = "/" + ofNullable(req.getSlug())
            .orElseGet(resourceService.getIdentifierSupplier());
        final PostHandler postHandler = new PostHandler(req, identifier, body, resourceService,
                ioService, binaryService, baseUrl);
        final Optional<Resource> parent = resourceService.get(rdf.createIRI(TRELLIS_PREFIX + path));
        if (parent.isPresent()) {
            final Optional<IRI> ixModel = parent.map(Resource::getInteractionModel);
            if (ixModel.filter(type -> ldpResourceTypes(type).anyMatch(LDP.Container::equals)).isPresent()) {
                return resourceService.get(rdf.createIRI(TRELLIS_PREFIX + path + identifier), MAX)
                    .map(x -> status(CONFLICT)).orElseGet(postHandler::createResource).build();
            } else if (parent.filter(RdfUtils::isDeleted).isPresent()) {
                return status(GONE).build();
            }
            return status(METHOD_NOT_ALLOWED).build();
        }
        return status(NOT_FOUND).build();
    }
@ POST @ Timed public Response createResource ( @ BeanParam final LdpRequest req , final File body ) { final String baseUrl = partitions . get ( req . getPartition ( ) ) ; final String path = req . getPartition ( ) + req . getPath ( ) ; final String identifier = "/" + ofNullable ( req . getSlug ( ) ) . orElseGet ( resourceService . getIdentifierSupplier ( ) ) ; final PostHandler postHandler = new PostHandler ( req , identifier , body , resourceService , ioService , binaryService , baseUrl ) ; final Optional < Resource > parent = resourceService . get ( rdf . createIRI ( TRELLIS_PREFIX + path ) ) ; if ( parent . isPresent ( ) ) { final Optional < IRI > ixModel = parent . map ( Resource :: getInteractionModel ) ; if ( ixModel . filter ( type -> ldpResourceTypes ( type ) . anyMatch ( LDP . Container :: equals ) ) . isPresent ( ) ) { return resourceService . get ( rdf . createIRI ( TRELLIS_PREFIX + path + identifier ) , MAX ) . map ( x -> status ( CONFLICT ) ) . orElseGet ( postHandler :: createResource ) . build ( ) ; } else if ( parent . filter ( RdfUtils :: isDeleted ) . isPresent ( ) ) { return status ( GONE ) . build ( ) ; } return status ( METHOD_NOT_ALLOWED ) . build ( ) ; } return status ( NOT_FOUND ) . build ( ) ; }
Perform a POST operation on a LDP Resource
 @param req the request
 @param body the body
 @return the response
Perform a POST operation on a LDP Resource @param req the request @param body the body @return the response
// First check if this is a container