Package org.trellisldp.common
Class TrellisRequest
- java.lang.Object
-
- org.trellisldp.common.TrellisRequest
-
public class TrellisRequest extends Object
A class representing an HTTP request with various LDP-related headers and query parameters.
-
-
Constructor Summary
Constructors Constructor Description TrellisRequest(Request request, UriInfo uriInfo, HttpHeaders headers)
Bundle together some request contexts.TrellisRequest(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secCtx)
Bundle together some request contexts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
buildBaseUrl(URI uri, MultivaluedMap<String,String> headers)
List<MediaType>
getAcceptableMediaTypes()
Get the HTTP headers.String
getBaseUrl()
Get a base url value.String
getContentType()
Get the Content-Type header.AcceptDatetime
getDatetime()
Get the Accept-Datetime value.String
getExt()
Get the ext value.MultivaluedMap<String,String>
getHeaders()
Get all of the headers.Link
getLink()
Get the Link header.String
getMethod()
Get the HTTP method.String
getPath()
Get the path.Prefer
getPrefer()
Get the prefer header.Range
getRange()
Get the range header.SecurityContext
getSecurityContext()
Get the security context.String
getSlug()
Get the slug header.Version
getVersion()
Get the version value.boolean
hasTrailingSlash()
Test whether the path has a trailing slash.
-
-
-
Constructor Detail
-
TrellisRequest
public TrellisRequest(Request request, UriInfo uriInfo, HttpHeaders headers)
Bundle together some request contexts.- Parameters:
request
- the Request objecturiInfo
- the URI informationheaders
- the HTTP headers
-
TrellisRequest
public TrellisRequest(Request request, UriInfo uriInfo, HttpHeaders headers, SecurityContext secCtx)
Bundle together some request contexts.- Parameters:
request
- the Request objecturiInfo
- the URI informationheaders
- the HTTP headerssecCtx
- the security context
-
-
Method Detail
-
getContentType
public String getContentType()
Get the Content-Type header.- Returns:
- the Content-Type header
-
getSlug
public String getSlug()
Get the slug header.- Returns:
- the decoded value of the slug header
-
getLink
public Link getLink()
Get the Link header.- Returns:
- the Link header
-
getDatetime
public AcceptDatetime getDatetime()
Get the Accept-Datetime value.- Returns:
- the accept-datetime header
-
getPrefer
public Prefer getPrefer()
Get the prefer header.- Returns:
- the Prefer header
-
getRange
public Range getRange()
Get the range header.- Returns:
- the range header
-
getPath
public String getPath()
Get the path.This method returns a normalized resource path for use with internal identifiers. That means that any trailing slash will not be present. Please see the
hasTrailingSlash()
method to check for a trailing slash.- Returns:
- the normalized path
-
hasTrailingSlash
public boolean hasTrailingSlash()
Test whether the path has a trailing slash.- Returns:
- true if the request path ends in a slash
-
getVersion
public Version getVersion()
Get the version value.- Returns:
- the version query parameter
-
getExt
public String getExt()
Get the ext value.- Returns:
- the ext query parameter
-
getBaseUrl
public String getBaseUrl()
Get a base url value.- Returns:
- the baseUrl as a string
-
getSecurityContext
public SecurityContext getSecurityContext()
Get the security context.- Returns:
- the security context
-
getMethod
public String getMethod()
Get the HTTP method.- Returns:
- the method name
-
getHeaders
public MultivaluedMap<String,String> getHeaders()
Get all of the headers.- Returns:
- the headers
-
getAcceptableMediaTypes
public List<MediaType> getAcceptableMediaTypes()
Get the HTTP headers.- Returns:
- the http headers
-
buildBaseUrl
public static String buildBaseUrl(URI uri, MultivaluedMap<String,String> headers)
-
-