Class ServletUtils

java.lang.Object
se.liu.ida.hefquin.service.ServletUtils

public class ServletUtils extends Object
Utility class for servlet-based integration of the HeFQUIN query engine.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.sparql.resultset.ResultsFormat
    convert(String mimeType)
    Converts a MIME type string into a corresponding ResultsFormat supported by Jena's SPARQL result serialization.
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServletUtils

      public ServletUtils()
  • Method Details

    • convert

      public static org.apache.jena.sparql.resultset.ResultsFormat convert(String mimeType)
      Converts a MIME type string into a corresponding ResultsFormat supported 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_CSV is 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 empty
      debug - true if 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 empty
      debug - true if 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