public class LdpUtils extends Object
LdpService
.Modifier and Type | Method and Description |
---|---|
static void |
exportIteration(org.openrdf.rio.RDFWriter writer,
org.openrdf.model.URI subject,
info.aduna.iteration.CloseableIteration<org.openrdf.model.Statement,org.openrdf.repository.RepositoryException> iteration)
LDP-Style to serialize a resource.
|
static List<org.openrdf.rio.RDFFormat> |
filterAvailableParsers(List<org.openrdf.rio.RDFFormat> rdfFormats) |
static List<org.openrdf.rio.RDFFormat> |
filterAvailableWriters(List<org.openrdf.rio.RDFFormat> rdfFormats) |
static String |
getAcceptPostHeader(String extraFormats) |
static String |
getContainer(String resource) |
static org.openrdf.model.URI |
getContainer(org.openrdf.model.URI resource) |
static String |
getExtension(javax.ws.rs.core.MediaType mediaType)
Get the preferred file extension for the content type
|
static String |
getExtension(String mimeType)
Get the preferred file extension for the content type
|
static String |
getMimeType(javax.ws.rs.core.MediaType mediaType)
Get only the mimeType from the
MediaType |
static <FF extends info.aduna.lang.FileFormat> |
matchDefaultMIMEType(String mimeType,
Iterable<FF> fileFormats)
Tries to match the specified MIME type with the MIME types of the supplied
file formats.
|
static <FF extends info.aduna.lang.FileFormat> |
matchDefaultMIMEType(String mimeType,
Iterable<FF> fileFormats,
FF fallback)
Tries to match the specified MIME type with the default MIME types of the supplied
file formats.
|
static Preference |
parsePreferHeader(PreferHeader prefer)
Convert a PreferHeader into a LDP Preference.
|
static String |
urify(String slugHeaderValue)
Urify the Slug: header value, i.e.
|
public static String urify(String slugHeaderValue)
slugHeaderValue
- the client-provided Slug-headerpublic static String getExtension(javax.ws.rs.core.MediaType mediaType)
mediaType
- content typepublic static String getExtension(String mimeType)
mimeType
- mimeTypepublic static String getMimeType(javax.ws.rs.core.MediaType mediaType)
MediaType
mediaType
- the mediaTypepublic static void exportIteration(org.openrdf.rio.RDFWriter writer, org.openrdf.model.URI subject, info.aduna.iteration.CloseableIteration<org.openrdf.model.Statement,org.openrdf.repository.RepositoryException> iteration) throws org.openrdf.rio.RDFHandlerException, org.openrdf.repository.RepositoryException
writer
- the writer to serialize tosubject
- the resource to serializeiteration
- the Iteration containing the dataorg.openrdf.rio.RDFHandlerException
org.openrdf.repository.RepositoryException
public static <FF extends info.aduna.lang.FileFormat> FF matchDefaultMIMEType(String mimeType, Iterable<FF> fileFormats)
FileFormat.matchMIMEType(String, Iterable)
but only considers the default mimeTypes.mimeType
- A MIME type, e.g. "text/plain".fileFormats
- The file formats to match the MIME type against.null
otherwise.matchDefaultMIMEType(String, Iterable, info.aduna.lang.FileFormat)
,
FileFormat.matchMIMEType(String, Iterable)
public static <FF extends info.aduna.lang.FileFormat> FF matchDefaultMIMEType(String mimeType, Iterable<FF> fileFormats, FF fallback)
FileFormat.matchMIMEType(String, Iterable, info.aduna.lang.FileFormat)
but only considers the default mimeTypes.mimeType
- A MIME type, e.g. "text/plain".fileFormats
- The file formats to match the MIME type against.fallback
- The file format to return if no matching format can be found.FileFormat.matchMIMEType(String, Iterable, info.aduna.lang.FileFormat)
public static String getContainer(String resource) throws MalformedURLException, URISyntaxException
public static org.openrdf.model.URI getContainer(org.openrdf.model.URI resource) throws MalformedURLException, URISyntaxException
public static Preference parsePreferHeader(PreferHeader prefer)
prefer
- the PreferHeader to parsepublic static List<org.openrdf.rio.RDFFormat> filterAvailableParsers(List<org.openrdf.rio.RDFFormat> rdfFormats)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.