Class JsonResponseHelper


  • public final class JsonResponseHelper
    extends java.lang.Object
    Helper class for JSON API servlets to send response messages.
    See Also:
    JsonHttp
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JsonResponseHelper.Status
      Possible results of an RPC operation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> create​(JsonResponseHelper.Status status, java.lang.String message)
      Same as create(Status, String, Iterable) but with zero results.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> create​(JsonResponseHelper.Status status, java.lang.String message, java.lang.Iterable<? extends java.util.Map<java.lang.String,​?>> results)
      Creates a JSON response message securely to the browser client with a parser breaker.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> create​(JsonResponseHelper.Status status, java.lang.String message, java.util.Map<java.lang.String,​?> result)
      Same as create(Status, String, Iterable) but with only one results.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> createFormFieldError​(java.lang.String message, java.lang.String formFieldName)
      Creates a JSON response message when a submitted form field is invalid.
      • Methods inherited from class java.lang.Object

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

      • JsonResponseHelper

        public JsonResponseHelper()
    • Method Detail

      • create

        public static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> create​(JsonResponseHelper.Status status,
                                                                                                             java.lang.String message,
                                                                                                             java.lang.Iterable<? extends java.util.Map<java.lang.String,​?>> results)
        Creates a JSON response message securely to the browser client with a parser breaker.
      • create

        public static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> create​(JsonResponseHelper.Status status,
                                                                                                             java.lang.String message,
                                                                                                             java.util.Map<java.lang.String,​?> result)
        Same as create(Status, String, Iterable) but with only one results.
      • createFormFieldError

        public static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> createFormFieldError​(java.lang.String message,
                                                                                                                           java.lang.String formFieldName)
        Creates a JSON response message when a submitted form field is invalid.