Class CmsJsonRequest


  • public class CmsJsonRequest
    extends java.lang.Object
    Class representing a JSON request. Provides utility functions for parameter validation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PARAM_CONTENT
      The content request parameter.
      static java.lang.String PARAM_FALLBACK_LOCALE
      The fallback locale request parameter.
      static java.lang.String PARAM_LEVELS
      The levels request parameter.
      static java.lang.String PARAM_LOCALE
      The locale request parameter.
      static java.lang.String PARAM_PATH
      The path request parameter.
      static java.lang.String PARAM_ROWS
      The rows request parameter.
      static java.lang.String PARAM_SORT
      The sort request parameter.
      static java.lang.String PARAM_START
      The start request parameter.
      static java.lang.String PARAM_WRAPPER
      The wrapper request parameter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CmsJsonHandlerContext getContext()
      Returns the JSON handler context.
      JSONObject getErrorsAsJson()
      Returns the errors of this request as JSON.
      java.lang.Boolean getParamBoolean​(java.lang.String bool)
      Returns the boolean parameter value for a given string.
      java.lang.Boolean getParamContent()
      Returns the content parameter as boolean.
      java.lang.Boolean getParamFallbackLocale()
      Returns the fallback locale parameter as boolean.
      java.lang.Integer getParamLevels()
      Returns the levels parameter as integer.
      java.lang.Integer getParamLevels​(int defaultLevels)
      Returns the levels parameter as integer.
      java.lang.String getParamLocale()
      Returns the locale parameter as string.
      java.lang.String getParamPath()
      Returns the path parameter as string.
      java.lang.Integer getParamRows()
      Returns the rows parameter as integer.
      java.lang.Integer getParamRows​(int defaultRows)
      Returns the rows parameter as integer.
      java.lang.String getParamSort()
      Returns the sort parameter as string.
      java.lang.String getParamSort​(java.lang.String defaultSort)
      Returns the sort parameter as string.
      java.lang.Integer getParamStart()
      Returns the start parameter as integer.
      java.lang.Integer getParamStart​(int defaultStart)
      Returns the rows parameter as integer.
      java.lang.Boolean getParamWrapper()
      Returns the wrapper parameter as string.
      java.lang.Boolean getParamWrapper​(boolean defaultWrapper)
      Returns the wrapper parameter as string.
      boolean hasErrors()
      Whether this JSON request has validation errors.
      void validate()
      Validates this request.
      • Methods inherited from class java.lang.Object

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

      • getParamBoolean

        public java.lang.Boolean getParamBoolean​(java.lang.String bool)
        Returns the boolean parameter value for a given string.

        Parameters:
        bool - the string
        Returns:
        the boolean
      • getParamContent

        public java.lang.Boolean getParamContent()
        Returns the content parameter as boolean.

        Returns:
        the content parameter as boolean
      • getParamFallbackLocale

        public java.lang.Boolean getParamFallbackLocale()
        Returns the fallback locale parameter as boolean.

        Returns:
        the fallback locale parameter as boolean
      • getParamLevels

        public java.lang.Integer getParamLevels()
        Returns the levels parameter as integer.

        Returns:
        the levels parameter as integer
      • getParamLevels

        public java.lang.Integer getParamLevels​(int defaultLevels)
        Returns the levels parameter as integer.

        Parameters:
        defaultLevels - if parameter is not set return this default value
        Returns:
        the levels parameter as integer
      • getParamLocale

        public java.lang.String getParamLocale()
        Returns the locale parameter as string.

        Returns:
        the levels parameter as integer
      • getParamPath

        public java.lang.String getParamPath()
        Returns the path parameter as string.

        Returns:
        the path parameter as string
      • getParamRows

        public java.lang.Integer getParamRows()
        Returns the rows parameter as integer.

        Returns:
        the rows parameter as integer
      • getParamRows

        public java.lang.Integer getParamRows​(int defaultRows)
        Returns the rows parameter as integer.

        Parameters:
        defaultRows - if parameter is not set return this default value
        Returns:
        the rows parameter as integer
      • getParamSort

        public java.lang.String getParamSort()
        Returns the sort parameter as string.

        Returns:
        the sort parameter as string
      • getParamSort

        public java.lang.String getParamSort​(java.lang.String defaultSort)
        Returns the sort parameter as string.

        Parameters:
        defaultSort - if parameter is not set return this default value
        Returns:
        the sort parameter as string
      • getParamStart

        public java.lang.Integer getParamStart()
        Returns the start parameter as integer.

        Returns:
        the start parameter as integer
      • getParamStart

        public java.lang.Integer getParamStart​(int defaultStart)
        Returns the rows parameter as integer.

        Parameters:
        defaultStart - if parameter is not set return this default value
        Returns:
        the rows parameter as integer
      • getParamWrapper

        public java.lang.Boolean getParamWrapper()
        Returns the wrapper parameter as string.

        Returns:
        the wrapper parameter as string
      • getParamWrapper

        public java.lang.Boolean getParamWrapper​(boolean defaultWrapper)
        Returns the wrapper parameter as string.

        Parameters:
        defaultWrapper - if parameter is not set return this default value
        Returns:
        the wrapper parameter as string
      • hasErrors

        public boolean hasErrors()
        Whether this JSON request has validation errors.
        Returns:
        whether has validation errors or not
      • validate

        public void validate()
        Validates this request.