java.lang.Object
org.apache.jena.fuseki.servlets.ActionLib
Operations related to servlets
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
actionURI
(javax.servlet.http.HttpServletRequest request) static void
consumeBody
(HttpAction action) Reset the request input stream for anHttpAction
if necessary.static MediaType
contentNegotation
(HttpAction action, AcceptList myPrefs, MediaType defaultMediaType) Negotiate the content-type and set the response headersstatic MediaType
contentNegotationQuads
(HttpAction action) Negotiate the content-type for an RDF quads syntax and set the response headersstatic MediaType
contentNegotationRDF
(HttpAction action) Negotiate the content-type for an RDF triples syntax and set the response headersstatic void
datasetResponse
(HttpAction action, DatasetGraph dsg, Lang lang) Output a dataset to the HTTP response.static void
datasetResponse
(HttpAction action, DatasetGraph dsg, RDFFormat format, String contentType) Output a dataset to the HTTP response.static void
doOptionsGet
(HttpAction action) static void
doOptionsGetHead
(HttpAction action) static void
doOptionsGetPost
(HttpAction action) static void
doOptionsGetPostDelete
(HttpAction action) static void
doOptionsGetPostDeleteHead
(HttpAction action) static void
doOptionsGetPostHead
(HttpAction action) static void
doOptionsPost
(HttpAction action) static ContentType
getContentType
(HttpAction action) Get the content type of an action.static RDFFormat
getNetworkFormatForLang
(Lang lang) static String
getOneHeader
(javax.servlet.http.HttpServletRequest request, String name) Get one or zero strings from an HTTP headerstatic void
graphResponse
(HttpAction action, Graph graph, Lang lang) Output a graph to the HTTP response.static void
graphResponse
(HttpAction action, Graph graph, RDFFormat format, String contentType) Output a graph to the HTTP response.static String
mapRequestToEndpointName
(String uri, DataAccessPoint dataAccessPoint) Calculate the operation, given request URI and data access pointstatic String
mapRequestToEndpointName
(HttpAction action, DataAccessPoint dataAccessPoint) Calculate the operation, given action and data access pointstatic void
parse
(HttpAction action, StreamRDF dest, InputStream input, Lang lang, String base) Parse RDF content.static void
parse
(HttpAction action, StreamRDF dest, Lang lang, String base) Parse RDF content.static void
parseOrError
(HttpAction action, StreamRDF dest, Lang lang, String base) Parse RDF content from the body of the request of the action, ends the request, and sends a 400 if there is a parse error.static Graph
readFromRequest
(HttpAction action, Lang defaultLang) static String
removeContextPath
(HttpAction action) static void
setCommonHeaders
(HttpAction action) static void
setCommonHeadersForOptions
(HttpAction action) static boolean
splitContains
(String[] elts, String str) static String[]
splitOnComma
(String string) Split a string on "," and remove leading and trailing whitespace on each elementstatic String
unused_mapRequestToDatasetLongest
(String uri, DataAccessPointRegistry registry) Implementation of mapRequestToDataset(String) that looks for the longest match in the registry.static String
wholeRequestURL
(javax.servlet.http.HttpServletRequest request) Calculate the full URL including query string for the HTTP request.
-
Constructor Details
-
ActionLib
public ActionLib()
-
-
Method Details
-
mapRequestToEndpointName
Calculate the operation, given action and data access point -
mapRequestToEndpointName
Calculate the operation, given request URI and data access point -
unused_mapRequestToDatasetLongest
public static String unused_mapRequestToDatasetLongest(String uri, DataAccessPointRegistry registry) Implementation of mapRequestToDataset(String) that looks for the longest match in the registry. This includes use in direct naming GSP. -
wholeRequestURL
Calculate the full URL including query string for the HTTP request. This may be quite long.- Parameters:
request
- HttpServletRequest- Returns:
- String The full URL, including query string.
-
removeContextPath
-
actionURI
- Returns:
- the URI without context path of the webapp and without query string.
-
contentNegotation
public static MediaType contentNegotation(HttpAction action, AcceptList myPrefs, MediaType defaultMediaType) Negotiate the content-type and set the response headers -
contentNegotationRDF
Negotiate the content-type for an RDF triples syntax and set the response headers -
contentNegotationQuads
Negotiate the content-type for an RDF quads syntax and set the response headers -
splitOnComma
Split a string on "," and remove leading and trailing whitespace on each element -
splitContains
-
parseOrError
Parse RDF content from the body of the request of the action, ends the request, and sends a 400 if there is a parse error.- Throws:
ActionErrorException
-
parse
Parse RDF content. This wraps up the parse step reading from an action. It includes handling compression if theContent-Encoding
header is present- Throws:
RiotParseException
-
parse
public static void parse(HttpAction action, StreamRDF dest, InputStream input, Lang lang, String base) Parse RDF content. This wraps up the parse step reading from an input stream.- Throws:
RiotParseException
-
consumeBody
Reset the request input stream for anHttpAction
if necessary. If there is aContent-Length
header, throw away input to exhaust this request. If there is a noContent-Length
header, no need to do anything - the connection is not reusable. -
readFromRequest
-
datasetResponse
Output a dataset to the HTTP response. -
datasetResponse
public static void datasetResponse(HttpAction action, DatasetGraph dsg, RDFFormat format, String contentType) Output a dataset to the HTTP response. -
graphResponse
Output a graph to the HTTP response. Bad, unwritable RDF/XML causes a "406 Not Acceptable". -
graphResponse
public static void graphResponse(HttpAction action, Graph graph, RDFFormat format, String contentType) Output a graph to the HTTP response. Bad, unwritable RDF/XML causes a "406 Not Acceptable". -
getNetworkFormatForLang
-
getOneHeader
Get one or zero strings from an HTTP header -
getContentType
Get the content type of an action.- Parameters:
action
-- Returns:
- ContentType
-
setCommonHeadersForOptions
-
setCommonHeaders
-
doOptionsGet
-
doOptionsGetHead
-
doOptionsGetPost
-
doOptionsGetPostHead
-
doOptionsGetPostDelete
-
doOptionsGetPostDeleteHead
-
doOptionsPost
-