java.lang.Object
org.apache.jena.fuseki.servlets.ActionLib
Operations related to servlets
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringactionURI(jakarta.servlet.http.HttpServletRequest request) static voidconsumeBody(HttpAction action) Reset the request input stream for anHttpActionif necessary.static org.apache.jena.atlas.web.MediaTypecontentNegotation(HttpAction action, org.apache.jena.atlas.web.AcceptList myPrefs, org.apache.jena.atlas.web.MediaType defaultMediaType) Negotiate the content-type and set the response headersstatic org.apache.jena.atlas.web.MediaTypecontentNegotationQuads(HttpAction action) Negotiate the content-type for an RDF quads syntax and set the response headersstatic org.apache.jena.atlas.web.MediaTypecontentNegotationRDF(HttpAction action) Negotiate the content-type for an RDF triples syntax and set the response headersstatic voiddatasetResponse(HttpAction action, org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.riot.Lang lang) Output a dataset to the HTTP response.static voiddatasetResponse(HttpAction action, org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.riot.RDFFormat format, String contentType) Output a dataset to the HTTP response.static voiddoOptionsGet(HttpAction action) static voiddoOptionsGetHead(HttpAction action) static voiddoOptionsGetPost(HttpAction action) static voiddoOptionsGetPostDelete(HttpAction action) static voiddoOptionsGetPostDeleteHead(HttpAction action) static voiddoOptionsGetPostHead(HttpAction action) static voiddoOptionsPost(HttpAction action) static StringgetContentMediaType(HttpAction action) Get the content type without any HTTP header field parameters such as "charset="static org.apache.jena.atlas.web.ContentTypegetContentType(HttpAction action) Get the content type of an action.static org.apache.jena.riot.RDFFormatgetNetworkFormatForLang(org.apache.jena.riot.Lang lang) Return the preferredRDFFormatfor a givenLang.static StringgetOneHeader(jakarta.servlet.http.HttpServletRequest request, String name) Get one or zero strings from an HTTP headerstatic voidgraphResponse(HttpAction action, org.apache.jena.graph.Graph graph, org.apache.jena.riot.Lang lang) Output a graph to the HTTP response.static voidgraphResponse(HttpAction action, org.apache.jena.graph.Graph graph, org.apache.jena.riot.RDFFormat format, String contentType) Output a graph to the HTTP response.static booleanisHTMLForm(HttpAction action) static StringmapRequestToEndpointName(String uri, DataAccessPoint dataAccessPoint) Calculate the operation, given request URI and data access pointstatic StringmapRequestToEndpointName(HttpAction action, DataAccessPoint dataAccessPoint) Calculate the operation, given action and data access pointstatic voidparse(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, InputStream input, org.apache.jena.riot.Lang lang, String base) Parse RDF content.static voidparse(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, org.apache.jena.riot.Lang lang, String base) Parse RDF content.static voidparseOrError(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, org.apache.jena.riot.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 org.apache.jena.graph.GraphreadFromRequest(HttpAction action, org.apache.jena.riot.Lang defaultLang) static StringremoveContextPath(HttpAction action) static voidsetCommonHeaders(HttpAction action) static voidsetCommonHeadersForOptions(HttpAction action) static booleansplitContains(String[] elts, String str) static String[]splitOnComma(String string) Split a string on "," and remove leading and trailing whitespace on each elementstatic Stringunused_mapRequestToDatasetLongest(String uri, DataAccessPointRegistry registry) Implementation of mapRequestToDataset(String) that looks for the longest match in the registry.static StringwholeRequestURL(jakarta.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 org.apache.jena.atlas.web.MediaType contentNegotation(HttpAction action, org.apache.jena.atlas.web.AcceptList myPrefs, org.apache.jena.atlas.web.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
public static void parseOrError(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, org.apache.jena.riot.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.- Throws:
ActionErrorException- ActionErrorException
-
parse
public static void parse(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, org.apache.jena.riot.Lang lang, String base) Parse RDF content. This wraps up the parse step reading from an action. It includes handling compression if theContent-Encodingheader is present- Throws:
org.apache.jena.riot.RiotParseException- RiotParseException
-
parse
public static void parse(HttpAction action, org.apache.jena.riot.system.StreamRDF dest, InputStream input, org.apache.jena.riot.Lang lang, String base) Parse RDF content. This wraps up the parse step reading from an input stream.- Throws:
org.apache.jena.riot.RiotParseException- RiotParseException
-
consumeBody
Reset the request input stream for anHttpActionif necessary. If there is aContent-Lengthheader, throw away input to exhaust this request. If there is a noContent-Lengthheader, no need to do anything - the connection is not reusable. -
readFromRequest
public static org.apache.jena.graph.Graph readFromRequest(HttpAction action, org.apache.jena.riot.Lang defaultLang) -
datasetResponse
public static void datasetResponse(HttpAction action, org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.riot.Lang lang) Output a dataset to the HTTP response. -
datasetResponse
public static void datasetResponse(HttpAction action, org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.riot.RDFFormat format, String contentType) Output a dataset to the HTTP response. -
graphResponse
public static void graphResponse(HttpAction action, org.apache.jena.graph.Graph graph, org.apache.jena.riot.Lang lang) Output a graph to the HTTP response. Bad, unwritable RDF/XML causes a "406 Not Acceptable". -
graphResponse
public static void graphResponse(HttpAction action, org.apache.jena.graph.Graph graph, org.apache.jena.riot.RDFFormat format, String contentType) Output a graph to the HTTP response. Bad, unwritable RDF/XML causes a "406 Not Acceptable". -
getNetworkFormatForLang
public static org.apache.jena.riot.RDFFormat getNetworkFormatForLang(org.apache.jena.riot.Lang lang) Return the preferredRDFFormatfor a givenLang. -
getOneHeader
Get one or zero strings from an HTTP header -
getContentType
Get the content type of an action.- Parameters:
action- HttpAction- Returns:
- ContentType
-
isHTMLForm
-
getContentMediaType
Get the content type without any HTTP header field parameters such as "charset=" -
setCommonHeadersForOptions
-
setCommonHeaders
-
doOptionsGet
-
doOptionsGetHead
-
doOptionsGetPost
-
doOptionsGetPostHead
-
doOptionsGetPostDelete
-
doOptionsGetPostDeleteHead
-
doOptionsPost
-