Class WebResponse

  • Direct Known Subclasses:
    WsResponse

    public abstract class WebResponse
    extends Object
    This abstract class defines common methods of Web responses.
    Author:
    BaseX Team 2005-23, BSD License, Christian Gruen
    • Field Detail

      • ctx

        protected final Context ctx
        Database context.
    • Constructor Detail

      • WebResponse

        protected WebResponse​(Context ctx)
        Constructor.
        Parameters:
        ctx - database context
    • Method Detail

      • create

        public final WebResponse.Response create​(WebFunction function,
                                                 Object data,
                                                 boolean body)
                                          throws QueryException,
                                                 IOException,
                                                 javax.servlet.ServletException
        Creates the Response.
        Parameters:
        function - function to be evaluated
        data - additional data (result, function, error, can be null)
        body - serialize body
        Returns:
        response type
        Throws:
        IOException - I/O Exception
        QueryException - query exception
        javax.servlet.ServletException - servlet exception
      • init

        protected abstract Expr[] init​(WebFunction function,
                                       Object data)
                                throws QueryException,
                                       IOException
        Initializes the evaluation of the specified function and binds function arguments.
        Parameters:
        function - web function
        data - additional data (result, function, error, can be null)
        Returns:
        function arguments
        Throws:
        QueryException - query exception
        IOException - I/O exception
      • serialize

        protected abstract WebResponse.Response serialize​(boolean body)
                                                   throws QueryException,
                                                          IOException,
                                                          javax.servlet.ServletException
        Serializes the response.
        Parameters:
        body - serialize body (if false, only the headers will be assigned)
        Returns:
        response type
        Throws:
        QueryException - query exception
        IOException - I/O exception
        javax.servlet.ServletException - servlet exception