Package org.trellisldp.http
Class TrellisHttpResource
- java.lang.Object
-
- org.trellisldp.http.TrellisHttpResource
-
@ApplicationScoped @Path("{path: .*}") @PermitAll public class TrellisHttpResource extends Object
An HTTP request matcher for path-based HTTP resource operations.
-
-
Constructor Summary
Constructors Constructor Description TrellisHttpResource()For use with RESTeasy and CDI.TrellisHttpResource(ServiceBundler trellis)Create a Trellis HTTP resource matcher.TrellisHttpResource(ServiceBundler trellis, Map<String,IRI> extensions, String baseUrl)Create a Trellis HTTP resource matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Response>createResource(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secContext, InputStream body)Perform a POST operation on a LDP Resource.CompletionStage<Response>deleteResource(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secContext)Perform a DELETE operation on an LDP Resource.CompletionStage<Response>getResource(Request request, UriInfo uriInfo, HttpHeaders headers)Perform a GET operation on an LDP Resource.CompletionStage<Response>getResourceHeaders(Request request, UriInfo uriInfo, HttpHeaders headers)Perform a HEAD operation on an LDP Resource.voidinitialize()Initialize the Trellis backend with a root container quads.CompletionStage<Response>options(Request request, UriInfo uriInfo, HttpHeaders headers)Perform an OPTIONS operation on an LDP Resource.CompletionStage<Response>setResource(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secContext, InputStream body)Perform a PUT operation on a LDP Resource.CompletionStage<Response>updateResource(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secContext, String body)Perform a PATCH operation on an LDP Resource.
-
-
-
Constructor Detail
-
TrellisHttpResource
@Inject public TrellisHttpResource(ServiceBundler trellis)
Create a Trellis HTTP resource matcher.- Parameters:
trellis- the Trellis application bundle
-
TrellisHttpResource
public TrellisHttpResource()
For use with RESTeasy and CDI.- API Note:
- This construtor is used by CDI runtimes that require a public, no-argument constructor. It should not be invoked directly in user code.
-
TrellisHttpResource
public TrellisHttpResource(ServiceBundler trellis, Map<String,IRI> extensions, String baseUrl)
Create a Trellis HTTP resource matcher.- Parameters:
trellis- the Trellis application bundleextensions- the extension graph mappingbaseUrl- a base URL
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
Initialize the Trellis backend with a root container quads.- API Note:
- In a CDI context, this initialization step will be called automatically. In a Java SE context, however, it may be necessary to invoke this method in code, though a ResourceService implementation may still choose to initialize itself independently of this method. In either case, if the persistence backend has already been initialized with a root resource, this method will make no changes to the storage layer.
-
getResource
@GET @Timed public CompletionStage<Response> getResource(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers)
Perform a GET operation on an LDP Resource.- Parameters:
uriInfo- the URI infoheaders- the HTTP headersrequest- the request- Returns:
- the async response
- Implementation Note:
- The Memento implemenation pattern exactly follows section 4.2.1 of RFC 7089.
-
getResourceHeaders
@HEAD @Timed public CompletionStage<Response> getResourceHeaders(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers)
Perform a HEAD operation on an LDP Resource.- Parameters:
uriInfo- the URI infoheaders- the HTTP headersrequest- the request- Returns:
- the async response
- Implementation Note:
- The Memento implemenation pattern exactly follows section 4.2.1 of RFC 7089.
-
options
@OPTIONS @Timed public CompletionStage<Response> options(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers)
Perform an OPTIONS operation on an LDP Resource.- Parameters:
uriInfo- the URI infoheaders- the HTTP headersrequest- the request- Returns:
- the async response
-
updateResource
@PATCH @Timed public CompletionStage<Response> updateResource(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context SecurityContext secContext, String body)
Perform a PATCH operation on an LDP Resource.- Parameters:
uriInfo- the URI infosecContext- the security contextheaders- the HTTP headersrequest- the requestbody- the body- Returns:
- the async response
-
deleteResource
@DELETE @Timed public CompletionStage<Response> deleteResource(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context SecurityContext secContext)
Perform a DELETE operation on an LDP Resource.- Parameters:
uriInfo- the URI infosecContext- the security contextheaders- the HTTP headersrequest- the request- Returns:
- the async response
-
createResource
@POST @Timed public CompletionStage<Response> createResource(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context SecurityContext secContext, InputStream body)
Perform a POST operation on a LDP Resource.- Parameters:
uriInfo- the URI infosecContext- the security contextheaders- the HTTP headersrequest- the requestbody- the body- Returns:
- the async response
-
setResource
@PUT @Timed public CompletionStage<Response> setResource(@Context Request request, @Context UriInfo uriInfo, @Context HttpHeaders headers, @Context SecurityContext secContext, InputStream body)
Perform a PUT operation on a LDP Resource.- Parameters:
uriInfo- the URI infosecContext- the security contextheaders- the HTTP headersrequest- the requestbody- the body- Returns:
- the async response
-
-