Package ubic.gemma.web.controller.util
Class JsonUtil
java.lang.Object
ubic.gemma.web.controller.util.JsonUtil
Utilities for writing JSON payloads to
HttpServletResponse.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwriteErrorToResponse(int status, String message, javax.servlet.http.HttpServletResponse response) static voidwriteErrorToResponse(Exception e, javax.servlet.http.HttpServletResponse response) Write an error message to the response based on the exception type.static voidwriteSuccessToResponse(javax.servlet.http.HttpServletResponse response) Write a simple JSON object with a "success" key set to true to the response.static voidwriteToResponse(org.json.JSONObject json, javax.servlet.http.HttpServletResponse response)
-
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
-