public abstract class ContentExposingResource extends FedoraBaseResource
Modifier and Type | Field and Description |
---|---|
protected PathLockManager |
lockManager |
static javax.ws.rs.core.MediaType |
MESSAGE_EXTERNAL_BODY |
protected MultiPrefer |
prefer |
protected javax.ws.rs.core.Request |
request |
protected FedoraResource |
resource |
protected javax.servlet.http.HttpServletResponse |
servletResponse |
idTranslator, session
binaryService, containerService, defaultPidMinter, eventBus, headers, namespaceService, nodeService, pidMinter, sessions, uriInfo, versionService
Constructor and Description |
---|
ContentExposingResource() |
Modifier and Type | Method and Description |
---|---|
protected static void |
addCacheControlHeaders(javax.servlet.http.HttpServletResponse servletResponse,
FedoraResource resource,
javax.jcr.Session session)
Add ETag and Last-Modified cache control headers to the response
|
protected void |
addResourceHttpHeaders(FedoraResource resource)
Add any resource-specific headers to the response
|
protected void |
addResourceLinkHeaders(FedoraResource resource) |
protected void |
addResourceLinkHeaders(FedoraResource resource,
boolean includeAnchor) |
protected static void |
checkCacheControlHeaders(javax.ws.rs.core.Request request,
javax.servlet.http.HttpServletResponse servletResponse,
FedoraResource resource,
javax.jcr.Session session)
Evaluate the cache control headers for the request to see if it can be served from
the cache.
|
protected static void |
evaluateRequestPreconditions(javax.ws.rs.core.Request request,
javax.servlet.http.HttpServletResponse servletResponse,
FedoraResource resource,
javax.jcr.Session session)
Evaluate request preconditions to ensure the resource is the expected state
|
protected abstract String |
externalPath() |
protected javax.ws.rs.core.Response |
getBinaryContent(String rangeValue)
Get the binary content of a datastream
|
protected javax.ws.rs.core.Response |
getContent(String rangeValue,
int limit,
RdfStream rdfStream)
This method returns an HTTP response with content body appropriate to the following arguments.
|
protected javax.ws.rs.core.Response |
getContent(String rangeValue,
RdfStream rdfStream) |
protected RdfStream |
getResourceTriples() |
protected RdfStream |
getResourceTriples(int limit)
This method returns a stream of RDF triples associated with this target resource
|
protected static javax.ws.rs.core.MediaType |
getSimpleContentType(javax.ws.rs.core.MediaType requestContentType) |
protected RdfStream |
getTriples(FedoraResource resource,
Set<? extends TripleCategory> x) |
protected RdfStream |
getTriples(FedoraResource resource,
TripleCategory x) |
protected RdfStream |
getTriples(Set<? extends TripleCategory> x) |
protected RdfStream |
getTriples(TripleCategory x) |
protected URI |
getUri(FedoraResource resource) |
protected boolean |
isExternalBody(javax.ws.rs.core.MediaType mediaType) |
protected static boolean |
isRdfContentType(String contentTypeString) |
protected void |
patchResourcewithSparql(FedoraResource resource,
String requestBody,
RdfStream resourceTriples) |
protected void |
replaceResourceBinaryWithStream(FedoraBinary result,
InputStream requestBodyStream,
org.glassfish.jersey.media.multipart.ContentDisposition contentDisposition,
javax.ws.rs.core.MediaType contentType,
Collection<String> checksums) |
protected void |
replaceResourceWithStream(FedoraResource resource,
InputStream requestBodyStream,
javax.ws.rs.core.MediaType contentType,
RdfStream resourceTriples) |
protected FedoraResource |
resource() |
asNode, getBaseUrlProperty, getResourceFromPath, session, setUpJMSInfo, translator
toPath
public static final javax.ws.rs.core.MediaType MESSAGE_EXTERNAL_BODY
@Context protected javax.ws.rs.core.Request request
@Context protected javax.servlet.http.HttpServletResponse servletResponse
@BeanParam protected MultiPrefer prefer
protected FedoraResource resource
@Inject protected PathLockManager lockManager
public ContentExposingResource()
protected abstract String externalPath()
protected javax.ws.rs.core.Response getContent(String rangeValue, RdfStream rdfStream) throws IOException
IOException
protected javax.ws.rs.core.Response getContent(String rangeValue, int limit, RdfStream rdfStream) throws IOException
rangeValue
- starting and ending byte offsets, see Range
limit
- is the number of child resources returned in the response, -1 for allrdfStream
- to which response RDF will be concatenatedIOException
- in case of error extracting contentprotected boolean isExternalBody(javax.ws.rs.core.MediaType mediaType)
protected RdfStream getResourceTriples()
protected RdfStream getResourceTriples(int limit)
limit
- is the number of child resources returned in the response, -1 for allRdfStream
protected javax.ws.rs.core.Response getBinaryContent(String rangeValue) throws IOException
rangeValue
- the range valueIOException
- if io exception occurredprotected RdfStream getTriples(Set<? extends TripleCategory> x)
protected RdfStream getTriples(FedoraResource resource, Set<? extends TripleCategory> x)
protected RdfStream getTriples(TripleCategory x)
protected RdfStream getTriples(FedoraResource resource, TripleCategory x)
protected URI getUri(FedoraResource resource)
protected FedoraResource resource()
protected void addResourceLinkHeaders(FedoraResource resource)
protected void addResourceLinkHeaders(FedoraResource resource, boolean includeAnchor)
protected void addResourceHttpHeaders(FedoraResource resource)
resource
- the resourceprotected static void checkCacheControlHeaders(javax.ws.rs.core.Request request, javax.servlet.http.HttpServletResponse servletResponse, FedoraResource resource, javax.jcr.Session session)
request
- the requestservletResponse
- the servlet responseresource
- the fedora resourcesession
- the sessionprotected static void addCacheControlHeaders(javax.servlet.http.HttpServletResponse servletResponse, FedoraResource resource, javax.jcr.Session session)
Note: In this implementation, the HTTP headers for ETags and Last-Modified dates are swapped for fedora:Binary resources and their descriptions. Here, we are drawing a distinction between the HTTP resource and the LDP resource. As an HTTP resource, the last-modified header should reflect when the resource at the given URL was last changed. With fedora:Binary resources and their descriptions, this is a little complicated, for the descriptions have, as their subjects, the binary itself. And the fedora:lastModified property produced by that NonRdfSourceDescription refers to the last-modified date of the binary -- not the last-modified date of the NonRdfSourceDescription.
servletResponse
- the servlet responseresource
- the fedora resourcesession
- the sessionprotected static void evaluateRequestPreconditions(javax.ws.rs.core.Request request, javax.servlet.http.HttpServletResponse servletResponse, FedoraResource resource, javax.jcr.Session session)
request
- the requestservletResponse
- the servlet responseresource
- the resourcesession
- the sessionprotected static javax.ws.rs.core.MediaType getSimpleContentType(javax.ws.rs.core.MediaType requestContentType)
protected static boolean isRdfContentType(String contentTypeString)
protected void replaceResourceBinaryWithStream(FedoraBinary result, InputStream requestBodyStream, org.glassfish.jersey.media.multipart.ContentDisposition contentDisposition, javax.ws.rs.core.MediaType contentType, Collection<String> checksums) throws InvalidChecksumException
InvalidChecksumException
protected void replaceResourceWithStream(FedoraResource resource, InputStream requestBodyStream, javax.ws.rs.core.MediaType contentType, RdfStream resourceTriples) throws MalformedRdfException
MalformedRdfException
protected void patchResourcewithSparql(FedoraResource resource, String requestBody, RdfStream resourceTriples)
Copyright © 2013–2016 DuraSpace, Inc.. All rights reserved.