Class WsFunction

  • All Implemented Interfaces:
    Comparable<WebFunction>

    public final class WsFunction
    extends WebFunction
    This class represents a single WebSocket function.
    Author:
    BaseX Team 2005-23, BSD License, Johannes Finckh
    • Field Detail

      • path

        public WsPath path
        Path of the function.
    • Constructor Detail

      • WsFunction

        public WsFunction​(StaticFunc function,
                          WebModule module,
                          QueryContext qc)
        Constructor.
        Parameters:
        function - associated user function
        module - web module
        qc - query context
    • Method Detail

      • parseAnnotations

        public boolean parseAnnotations​(Context ctx)
                                 throws QueryException
        Description copied from class: WebFunction
        Checks a function for REST and permission annotations. This function is called both when a module is parsed, and when the function is prepared for evaluation.
        Specified by:
        parseAnnotations in class WebFunction
        Parameters:
        ctx - database context
        Returns:
        true if function contains relevant annotations
        Throws:
        QueryException - query exception
      • matches

        public boolean matches​(Annotation definition,
                               WsPath pth)
        Checks if an WebSocket request matches this annotation and path.
        Parameters:
        definition - annotation definition (can be null)
        pth - path to compare to (can be null)
        Returns:
        boolean result of check
      • compareTo

        public int compareTo​(WebFunction func)
      • error

        public QueryException error​(String msg,
                                    Object... ext)
        Creates an exception with the specified message.
        Specified by:
        error in class WebFunction
        Parameters:
        msg - message
        ext - error extension
        Returns:
        exception