Class ServletUtils
java.lang.Object
se.liu.ida.hefquin.service.ServletUtils
Utility class for servlet-based integration of the HeFQUIN query engine.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.sparql.resultset.ResultsFormatConverts a MIME type string into a correspondingResultsFormatsupported by Jena's SPARQL result serialization.static org.apache.jena.atlas.json.JsonArraygetExceptions(List<Exception> exceptions, boolean debug) Converts the exceptions of the given object into a JSON array of JSON objects.static org.apache.jena.atlas.json.JsonArraygetExceptions(QueryProcessingStatsAndExceptions statsAndExcs, boolean debug) Converts the exceptions of the given object into a JSON array of JSON objects.
-
Constructor Details
-
ServletUtils
public ServletUtils()
-
-
Method Details
-
convert
Converts a MIME type string into a correspondingResultsFormatsupported by Jena's SPARQL result serialization. Recognized MIME types: - application/sparql-results+json - application/sparql-results+xml - text/csv - text/tab-separated-values If the MIME type is unrecognized or null,ResultsFormat.FMT_RS_CSVis returned by default.- Parameters:
mimeType- the MIME type string from the HTTP Accept header or elsewhere- Returns:
- the corresponding
ResultsFormat, or null if the input was null
-
getExceptions
public static org.apache.jena.atlas.json.JsonArray getExceptions(QueryProcessingStatsAndExceptions statsAndExcs, boolean debug) Converts the exceptions of the given object into a JSON array of JSON objects. Each JSON object contains the exception type, message and, if debug mode is enabled, the full stack trace.- Parameters:
statsAndExcs- object that contain a list of exceptions; may be null or emptydebug-trueif full stack trace for each exception should be included- Returns:
- a JSON array where each entry is a JSON object containing the exception type, message and, if debug mode is enabled, its full stack trace
-
getExceptions
public static org.apache.jena.atlas.json.JsonArray getExceptions(List<Exception> exceptions, boolean debug) Converts the exceptions of the given object into a JSON array of JSON objects. Each JSON object contains the exception type, message and, if debug mode is enabled, the full stack trace.- Parameters:
exceptions- the list of exceptions encountered during query processing; may be null or emptydebug-trueif full stack trace for each exception should be included- Returns:
- a JSON array where each entry is a JSON object containing the exception type, message and, if debug mode is enabled, its full stack trace
-