lambdora-http-api/src/main/java/org/fcrepo/lambdora/ldp/LambdoraLdp.java
/**
     * Creates a new object.
     *
     * This originally used application/octet-stream;qs=1001 as a workaround
     * for JERSEY-2636, to ensure requests without a Content-Type get routed here.
     * This qs value does not parse with newer versions of Jersey, as qs values
     * must be between 0 and 1.  We use qs=1.000 to mark where this historical
     * anomaly had been.
     *
     * @param contentDisposition the content Disposition value
     * @param requestContentType the request content type
     * @param slug the slug value
     * @param requestBodyStream  the request body stream
     * @param link the link value
     * @param digest the digest header
     * @return 201
     * @throws InvalidChecksumException if invalid checksum exception occurred
     * @throws IOException if IO exception occurred
     * @throws MalformedRdfException if malformed rdf exception occurred
     */
Creates a new object.
This originally used application/octet-stream;qs=1001 as a workaround
for JERSEY-2636, to ensure requests without a Content-Type get routed here.
This qs value does not parse with newer versions of Jersey, as qs values
must be between 0 and 1.  We use qs=1.000 to mark where this historical
anomaly had been.


Creates a new object . This originally used application / octet - stream ; qs = 1001 as a workaround for JERSEY - 2636 to ensure requests without a Content - Type get routed here . This qs value does not parse with newer versions of Jersey as qs values must be between 0 and 1 . We use qs = 1 . 000 to mark where this historical anomaly had been .
@POST
    @Consumes({MediaType.APPLICATION_OCTET_STREAM + ";qs=1.000", WILDCARD})
    @Produces({TURTLE_WITH_CHARSET + ";qs=1.0", JSON_LD + ";qs=0.8",
            N3_WITH_CHARSET, N3_ALT2_WITH_CHARSET, RDF_XML, NTRIPLES, TEXT_PLAIN_WITH_CHARSET,
            TURTLE_X, TEXT_HTML_WITH_CHARSET, "*/*"})
    public Response createObject(@HeaderParam(CONTENT_DISPOSITION) final ContentDisposition contentDisposition,
                                 @HeaderParam(CONTENT_TYPE) final MediaType requestContentType,
                                 @HeaderParam("Slug") final String slug,
                                 @ContentLocation final InputStream requestBodyStream,
                                 @HeaderParam(LINK) final String link,
                                 @HeaderParam("Digest") final String digest)
            throws InvalidChecksumException, IOException, MalformedRdfException {
        LOGGER.info("POST: {}", externalPath);
        final ContainerService containerService = getContainerService();
        final URI resourceUri = createFromPath(externalPath);
        if (!containerService.exists(resourceUri)) {
            if (!isRoot(resourceUri)) {
                return status(NOT_FOUND).build();
            } else {
                createRoot();
            }
        }
        final String newResourceName = slug == null ? UUID.randomUUID().toString() : slug;
        final String resourcePath = (isRoot(resourceUri) ? "" : resourceUri.getPath());
        final URI newResourceUri = createFromPath(resourcePath + "/" + newResourceName);
        final Container container = containerService.findOrCreate(newResourceUri);
        final Model model = ModelFactory.createDefaultModel();
        model.read(requestBodyStream, container.getIdentifier().toString(), "TTL");
        final Stream<Triple> triples = model.listStatements().toList().stream().map(Statement::asTriple);
        container.updateTriples(triples);
        return created(toExternalURI(container.getIdentifier(), headers)).build();
    }
@ POST @ Consumes ( { MediaType . APPLICATION_OCTET_STREAM + ";qs=1.000" , WILDCARD } ) @ Produces ( { TURTLE_WITH_CHARSET + ";qs=1.0" , JSON_LD + ";qs=0.8" , N3_WITH_CHARSET , N3_ALT2_WITH_CHARSET , RDF_XML , NTRIPLES , TEXT_PLAIN_WITH_CHARSET , TURTLE_X , TEXT_HTML_WITH_CHARSET , "*/*" } ) public Response createObject ( @ HeaderParam ( CONTENT_DISPOSITION ) final ContentDisposition contentDisposition , @ HeaderParam ( CONTENT_TYPE ) final MediaType requestContentType , @ HeaderParam ( "Slug" ) final String slug , @ ContentLocation final InputStream requestBodyStream , @ HeaderParam ( LINK ) final String link , @ HeaderParam ( "Digest" ) final String digest ) throws InvalidChecksumException , IOException , MalformedRdfException { LOGGER . info ( "POST: {}" , externalPath ) ; final ContainerService containerService = getContainerService ( ) ; final URI resourceUri = createFromPath ( externalPath ) ; if ( ! containerService . exists ( resourceUri ) ) { if ( ! isRoot ( resourceUri ) ) { return status ( NOT_FOUND ) . build ( ) ; } else { createRoot ( ) ; } } final String newResourceName = slug == null ? UUID . randomUUID ( ) . toString ( ) : slug ; final String resourcePath = ( isRoot ( resourceUri ) ? "" : resourceUri . getPath ( ) ) ; final URI newResourceUri = createFromPath ( resourcePath + "/" + newResourceName ) ; final Container container = containerService . findOrCreate ( newResourceUri ) ; final Model model = ModelFactory . createDefaultModel ( ) ; model . read ( requestBodyStream , container . getIdentifier ( ) . toString ( ) , "TTL" ) ; final Stream < Triple > triples = model . listStatements ( ) . toList ( ) . stream ( ) . map ( Statement :: asTriple ) ; container . updateTriples ( triples ) ; return created ( toExternalURI ( container . getIdentifier ( ) , headers ) ) . build ( ) ; }
Creates a new object.
Creates a new object .
//check that resource exists