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
    Converts a list of exceptions into a JSON array, including class name, message, and full stack trace for each exception.
    static org.apache.jena.atlas.json.JsonArray
    Converts the exceptions of the given object into a JSON array, including class name, message, and full stack trace for each exception.

    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)
      Converts the exceptions of the given object into a JSON array, including class name, message, and full stack trace for each exception.
      Parameters:
      statsAndExcs - object that contain a list of exceptions; may be null or empty
      Returns:
      a JSON array where each entry is a string representation of an exception and its stack trace
    • getExceptions

      public static org.apache.jena.atlas.json.JsonArray getExceptions(List<Exception> exceptions)
      Converts a list of exceptions into a JSON array, including class name, message, and full stack trace for each exception.
      Parameters:
      exceptions - the list of exceptions encountered during query processing; may be null or empty
      Returns:
      a JSON array where each entry is a string representation of an exception and its stack trace