public abstract class BigdataRDFServlet extends BigdataServlet
Servlet
s which interact with the bigdata RDF
data and/or SPARQL query layers.Modifier and Type | Field and Description |
---|---|
static String |
ATTR_BLUEPRINTS
Flag to signify a blueprints operation.
|
static String |
MIME_JSON |
static String |
MIME_RDF_XML
RDF/XML.
|
static String |
MIME_SPARQL_QUERY |
static String |
MIME_SPARQL_RESULTS_JSON
A SPARQL results set in JSON.
|
static String |
MIME_SPARQL_RESULTS_XML
A SPARQL results set in XML.
|
static String |
MIME_SPARQL_UPDATE |
protected static String |
NA |
static String |
OUTPUT_FORMAT_JSON |
static String |
OUTPUT_FORMAT_JSON_SHORT |
static String |
OUTPUT_FORMAT_QUERY_PARAMETER |
static String |
OUTPUT_FORMAT_XML |
static String |
OUTPUT_FORMAT_XML_SHORT |
static String |
UNDEFINED_WORKBENCH_NAMESPACE |
protected static String |
UTF8
The name of the
UTF-8 character encoding. |
ATTRIBUTE_RDF_CONTEXT, charset, DELETE, GET, HTTP_BADREQUEST, HTTP_HEADER_BIGDATA_READ_ONLY, HTTP_INTERNALERROR, HTTP_METHOD_NOT_ALLOWED, HTTP_NOTFOUND, HTTP_NOTIMPLEMENTED, HTTP_OK, POST, PUT
MIME_APPLICATION_JSON, MIME_APPLICATION_URL_ENCODED, MIME_APPLICATION_XML, MIME_DEFAULT_BINARY, MIME_GRAPH_ML, MIME_PROPERTIES_XML, MIME_TEXT_HTML, MIME_TEXT_JAVASCRIPT, MIME_TEXT_PLAIN
Constructor and Description |
---|
BigdataRDFServlet() |
Modifier and Type | Method and Description |
---|---|
protected static void |
buildAndCommitBooleanResponse(javax.servlet.http.HttpServletResponse resp,
boolean result,
long elapsed)
Report an boolean response and elapsed time back to the user agent.
|
protected void |
buildAndCommitNamespaceNotFoundResponse(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Report that a namespace is not found.
|
protected static void |
buildAndCommitRangeCountResponse(javax.servlet.http.HttpServletResponse resp,
long rangeCount,
long elapsed)
Report an access path range count and elapsed time back to the user agent.
|
protected String |
getNamespace(javax.servlet.http.HttpServletRequest req)
Return the namespace which will be used to execute the query.
|
protected long |
getTimestamp(javax.servlet.http.HttpServletRequest req)
Return the timestamp which will be used to execute the query.
|
protected static boolean |
isAttachment(String mimeType)
Return
true if the Content-disposition header
should be set to indicate that the response body should be handled as an
attachment rather than presented inline. |
static void |
launderThrowable(Throwable t,
javax.servlet.http.HttpServletResponse resp,
String queryStr)
Best effort to write the stack trace onto the output stream so it will
show up in the HTTP response.
|
protected static PipedInputStream |
newPipedInputStream(PipedOutputStream os)
Factory for the
PipedInputStream . |
protected Map<String,org.openrdf.model.Value> |
parseBindings(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Parses query parameter bindings for validity to provide client with
meaningful response.
|
static void |
sendGraph(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
org.openrdf.model.Graph g)
Send an RDF Graph as a response using content negotiation.
|
protected static void |
sendProperties(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
Properties properties)
Send a properties file as a response using content negotiation.
|
protected static org.openrdf.model.Resource[] |
toURIs(String[] s)
Convert an array of URI strings to an array of URIs.
|
buildAndCommitResponse, decodeContexts, getBigdataRDFContext, getBooleanValue, getIndexManager, getIndexManager, getServiceURIs, readFully, submitApiTask
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
protected static final String UTF8
UTF-8
character encoding.protected static final String NA
public static final transient String MIME_SPARQL_RESULTS_XML
http://www.w3.org/TR/rdf-sparql-XMLres/
,
Constant Field Valuespublic static final transient String MIME_SPARQL_RESULTS_JSON
http://www.w3.org/TR/rdf-sparql-json-res/
,
Constant Field Valuespublic static final transient String MIME_RDF_XML
public static final String MIME_JSON
public static final String MIME_SPARQL_QUERY
public static final String MIME_SPARQL_UPDATE
public static final String OUTPUT_FORMAT_QUERY_PARAMETER
public static final String OUTPUT_FORMAT_JSON
public static final String OUTPUT_FORMAT_XML
public static final String OUTPUT_FORMAT_JSON_SHORT
public static final String OUTPUT_FORMAT_XML_SHORT
public static final String UNDEFINED_WORKBENCH_NAMESPACE
public static final transient String ATTR_BLUEPRINTS
public static void launderThrowable(Throwable t, javax.servlet.http.HttpServletResponse resp, String queryStr)
HttpServletResponse.SC_BAD_REQUEST
) should
verify the request before proceeding in order to satisify their API
semantics.
This method is invoked as follows:
launderThrowable(...)This method MUST be invoked from the top-level where the request is handled. The servlet container may ABORT the connection if there is an attempt to write onto a closed response. This can cause EOF errors in the client.
t
- The thrown error.os
- The stream on which the response will be written.queryStr
- The SPARQL Query -or- SPARQL Update command (if available)
-or- a summary of the REST API command -or- an empty string if
nothing else is more appropriate.protected long getTimestamp(javax.servlet.http.HttpServletRequest req)
timestamp
may be used to communicate the
desired commit time against which the query will be issued. If that uri
query parameter is not given then the default configured commit time will
be used. Applications may create protocols for sharing interesting commit
times as reported by IAtomicStore.commit()
or by a distributed
data loader (for scale-out).QueryServlet#ATTR_TIMESTAMP;
protected String getNamespace(javax.servlet.http.HttpServletRequest req)
protected static final PipedInputStream newPipedInputStream(PipedOutputStream os) throws IOException
PipedInputStream
.IOException
protected void buildAndCommitNamespaceNotFoundResponse(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
HttpServletRequest
.IOException
protected static void buildAndCommitRangeCountResponse(javax.servlet.http.HttpServletResponse resp, long rangeCount, long elapsed) throws IOException
resp
- The response.rangeCount
- The mutation count.elapsed
- The elapsed time (milliseconds).IOException
protected static void buildAndCommitBooleanResponse(javax.servlet.http.HttpServletResponse resp, boolean result, long elapsed) throws IOException
where result is either "true" or "false";
resp
- The response.result
- The outcome of the request.elapsed
- The elapsed time (milliseconds).IOException
public static void sendGraph(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, org.openrdf.model.Graph g) throws IOException
req
- resp
- IOException
protected static void sendProperties(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Properties properties) throws IOException
req
- resp
- IOException
protected static boolean isAttachment(String mimeType)
true
if the Content-disposition
header
should be set to indicate that the response body should be handled as an
attachment rather than presented inline. This is just a hint to the user
agent. How the user agent handles this hint is up to it.mimeType
- The mime type.true
if it should be handled as an attachment.protected static org.openrdf.model.Resource[] toURIs(String[] s)
protected Map<String,org.openrdf.model.Value> parseBindings(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
req
- resp
- null
if there was an error
processing the bindings, in which case the response was already
committed.IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.