use of javax.ws.rs.core.MediaType.APPLICATION_XML in project trellis by trellis-ldp.
the class TrellisWebDAV method getResourceProperties.
/**
* Get properties for a resource.
* @param propfind the propfind
* @return the response
* @throws ParserConfigurationException if the XML parser is not properly configured
*/
@PROPFIND
@Consumes({ APPLICATION_XML })
@Produces({ APPLICATION_XML })
@Timed
public CompletionStage<Response> getResourceProperties(final DavPropFind propfind) throws ParserConfigurationException {
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final String location = fromUri(getBaseUrl(req)).path(req.getPath()).build().toString();
final Document doc = getDocument();
return services.getResourceService().get(identifier).thenApply(this::checkResource).thenApply(propertiesToMultiStatus(doc, location, propfind)).thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build()).exceptionally(this::handleException);
}
use of javax.ws.rs.core.MediaType.APPLICATION_XML in project trellis by trellis-ldp.
the class TrellisWebDAV method updateProperties.
/**
* Update properties on a resource.
* @param propertyUpdate the property update request
* @return the async response
* @throws ParserConfigurationException if the XML parser is not properly configured
*/
@PROPPATCH
@Consumes({ APPLICATION_XML })
@Produces({ APPLICATION_XML })
@Timed
public CompletionStage<Response> updateProperties(final DavPropertyUpdate propertyUpdate) throws ParserConfigurationException {
final Document doc = getDocument();
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, security);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final String baseUrl = getBaseUrl(req);
final String location = fromUri(baseUrl).path(req.getPath()).build().toString();
final Session session = HttpSession.from(security);
return services.getResourceService().get(identifier).thenApply(this::checkResource).thenCompose(resourceToMultiStatus(doc, identifier, location, baseUrl, session, propertyUpdate)).thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build()).exceptionally(this::handleException);
}
Aggregations