Class ResponsiveExternalObject

  • All Implemented Interfaces:
    CacheInterface, java.io.Serializable

    public abstract class ResponsiveExternalObject
    extends ExternalObject
    Responsive component external object.
    This class returns a simple JavaScript statement that calls a render function passing it the requests parameters.
    By default the render statement is <name of the external object>.render(params).
    See Also:
    Serialized Form
    • Constructor Detail

      • ResponsiveExternalObject

        public ResponsiveExternalObject()
    • Method Detail

      • getRenderFunction

        public java.lang.String getRenderFunction()
        Get render function name hook
        Returns:
        Render function (<Object name>.render by default)
      • getRenderStatement

        public java.lang.String getRenderStatement​(Parameters params)
        Get render statement hook
        Parameters:
        params - Parameters
        Returns:
        Render statement (wraps render function call by default)
      • serviceError

        public org.json.JSONObject serviceError​(int code,
                                                java.lang.String message)
        Service error response
        Parameters:
        code - HTTP status
        message - Error message
        Returns:
        JSON object
      • serviceBadRequestError

        public final org.json.JSONObject serviceBadRequestError​(java.lang.Throwable e)
        Service bad request error
        Parameters:
        e - Throwable
        Returns:
        JSON object
      • serviceBadRequestError

        public final org.json.JSONObject serviceBadRequestError()
        Service bad request error
        Returns:
        JSON object
      • serviceBadRequestError

        public final org.json.JSONObject serviceBadRequestError​(java.lang.String message)
        Service bad request error
        Parameters:
        message - Message
        Returns:
        JSON object
      • serviceInternalServerError

        public final org.json.JSONObject serviceInternalServerError​(java.lang.Throwable e)
        Service internal server error
        Parameters:
        e - Throwable
        Returns:
        JSON object
      • serviceInternalServerError

        public final org.json.JSONObject serviceInternalServerError()
        Service internal server error
        Returns:
        JSON object
      • serviceInternalServerError

        public final org.json.JSONObject serviceInternalServerError​(java.lang.String message)
        Service internal server error
        Parameters:
        message - Message
        Returns:
        JSON object
      • service

        public java.lang.Object service​(Parameters params)
        JSON service hook (called in POST/PUT/DELETE)
        Parameters:
        params - Parameters
        Returns:
        JSON object or array or string (bad request error by default)
      • content

        public java.lang.String content​(Parameters params)
        Get component content hook
        Parameters:
        params - Parameters
        Returns:
        HTML content
      • isEmbedded

        public boolean isEmbedded​(Parameters params)
        Is embedded hook
        Parameters:
        params - Parameters
        Returns:
        True if embedded (defaults to the value of the "embedded" parameter)
      • display

        public final java.lang.String display​(Parameters params)
        Display method:
        • if called in GET it calls the render function given by the getRenderFunction hook (the HTML body and Javascript code must be configured as resources)
        • if called in POST/PUT/DELETE it calls
        Overrides:
        display in class ExternalObject
        Parameters:
        params - Parameters
        Returns:
        Content to display (either as String for text content or as byte array for binary content)