Class CmsJsonRequest

java.lang.Object
org.opencms.xml.xml2json.CmsJsonRequest

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

  • Constructor Details

  • Method Details

    • getContext

      Returns the JSON handler context.

      Returns:
      the JSON handler context
    • getErrorsAsJson

      Returns the errors of this request as JSON.

      Returns:
      the errors as JSON
      Throws:
      JSONException - if JSON rendering fails
    • getParamBoolean

      Returns the boolean parameter value for a given string.

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

      Returns the content parameter as boolean.

      Returns:
      the content parameter as boolean
    • getParamFallbackLocale

      Returns the fallback locale parameter as boolean.

      Returns:
      the fallback locale parameter as boolean
    • getParamLevels

      Returns the levels parameter as integer.

      Returns:
      the levels parameter as integer
    • getParamLevels

      public 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

      Returns the locale parameter as string.

      Returns:
      the levels parameter as integer
    • getParamPath

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

      Returns:
      the path parameter as string
    • getParamRows

      Returns the rows parameter as integer.

      Returns:
      the rows parameter as integer
    • getParamRows

      public 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 String getParamSort()
      Returns the sort parameter as string.

      Returns:
      the sort parameter as string
    • getParamSort

      public String getParamSort(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

      Returns the start parameter as integer.

      Returns:
      the start parameter as integer
    • getParamStart

      public 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

      Returns the wrapper parameter as string.

      Returns:
      the wrapper parameter as string
    • getParamWrapper

      public 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.