Class JsonUtil

java.lang.Object
ubic.gemma.web.controller.util.JsonUtil

public final class JsonUtil extends Object
Utilities for writing JSON payloads to HttpServletResponse.
  • Constructor Details

    • JsonUtil

      public JsonUtil()
  • Method Details

    • writeSuccessToResponse

      public static void writeSuccessToResponse(javax.servlet.http.HttpServletResponse response) throws IOException
      Write a simple JSON object with a "success" key set to true to the response.
      Throws:
      IOException
    • writeErrorToResponse

      public static void writeErrorToResponse(Exception e, javax.servlet.http.HttpServletResponse response) throws IOException
      Write an error message to the response based on the exception type.
      Throws:
      IOException
    • writeErrorToResponse

      public static void writeErrorToResponse(int status, String message, javax.servlet.http.HttpServletResponse response) throws IOException
      Throws:
      IOException
    • writeToResponse

      public static void writeToResponse(org.json.JSONObject json, javax.servlet.http.HttpServletResponse response) throws IOException
      Throws:
      IOException