Package org.fcrepo.http.commons.api.rdf
Class HttpIdentifierConverter
java.lang.Object
org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter
Convert between HTTP URIs (LDP paths) and internal Fedora ID using a
JAX-RS UriBuilder to mediate the URI translation.
- Since:
- 2019-09-26
- Author:
- whikloj
-
Constructor Summary
ConstructorsConstructorDescriptionHttpIdentifierConverter(javax.ws.rs.core.UriBuilder uriBuilder) Create a new identifier converter with the given URI template. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninExternalDomain(String httpUri) Test if the provided external URI is in the domain of this repository.booleaninInternalDomain(String fedoraId) Check if the provided internal identifier is in the domain of the repository.org.fcrepo.kernel.api.identifiers.FedoraIdpathToInternalId(String externalPath) Function to convert from the external path of a URI to an internal FedoraId.Convert a path to a full url using the UriBuilder template.toExternalId(String fedoraId) Convert an internal identifier to an external URI.toInternalId(String httpUri) Convert an external URI to an internal ID.toInternalId(String httpUri, boolean encoded) Convert an external URI to an internal ID.translateUri(String httpUri) Make a URI into an absolute URI (if relative), an internal encoded ID (if in repository domain) or leave it alone.
-
Constructor Details
-
HttpIdentifierConverter
Create a new identifier converter with the given URI template.- Parameters:
uriBuilder- the uri builder
-
-
Method Details
-
toInternalId
Convert an external URI to an internal ID.- Parameters:
httpUri- the external URI.- Returns:
- the internal identifier.
-
toInternalId
Convert an external URI to an internal ID.- Parameters:
httpUri- the external URI.encoded- whether the internal ID is encoded or not.- Returns:
- the internal identifier.
-
inExternalDomain
Test if the provided external URI is in the domain of this repository. If it is not in the domain we can't convert it.- Parameters:
httpUri- the external URI.- Returns:
- true if it is in domain.
-
translateUri
Make a URI into an absolute URI (if relative), an internal encoded ID (if in repository domain) or leave it alone.- Parameters:
httpUri- the URI- Returns:
- an absolute URI, the original URI or an internal ID.
-
toExternalId
Convert an internal identifier to an external URI.- Parameters:
fedoraId- the internal identifier.- Returns:
- the external URI.
-
inInternalDomain
Check if the provided internal identifier is in the domain of the repository. If it is not in the domain we can't convert it.- Parameters:
fedoraId- the internal identifier.- Returns:
- true if it is in domain.
-
toDomain
Convert a path to a full url using the UriBuilder template.- Parameters:
path- the external path.- Returns:
- the full url.
-
pathToInternalId
Function to convert from the external path of a URI to an internal FedoraId.- Parameters:
externalPath- the path part of the external URI.- Returns:
- the FedoraId.
-