Class ResponsiveExternalObject

  • All Implemented Interfaces:
    com.simplicite.util.engine.CacheInterface, java.io.Serializable

    public 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, data).
    See Also:
    Serialized Form
    • Constructor Detail

      • ResponsiveExternalObject

        public ResponsiveExternalObject()
    • Method Detail

      • init

        public void init​(Parameters params)
        Init method to override if needed
      • getData

        @Deprecated(forRemoval=false,
                    since="5")
        public org.json.JSONObject getData​(Parameters params)
        Deprecated.
        Use the data hook instead
      • data

        public org.json.JSONObject data​(Parameters params)
        Data hook
        Parameters:
        params - Parameters
        Returns:
        Data
      • getJSIncludes

        public java.lang.String[] getJSIncludes()
        Get Javascript libs URLs hook
        Returns:
        List of JS libs URLs
      • getCSSIncludes

        public java.lang.String[] getCSSIncludes()
        Get CSS stylesheets URLs hook
        Returns:
        List of CSS stylesheets URLs
      • 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 (by defaults wraps the render function returned by getRenderFunction())
      • serviceInfo

        public org.json.JSONObject serviceInfo​(java.lang.String message)
        Service info response
        Parameters:
        message - Information message
        Returns:
        JSON object
      • 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
      • 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)