Class WebFunction

java.lang.Object
org.basex.http.web.WebFunction
All Implemented Interfaces:
Comparable<WebFunction>
Direct Known Subclasses:
RestXqFunction, WsFunction

public abstract class WebFunction extends Object implements Comparable<WebFunction>
This abstract class defines common methods of Web functions.
Author:
BaseX Team 2005-21, BSD License, Johannes Finckh
  • Field Details

    • function

      public final StaticFunc function
      Associated function.
    • output

      public final SerializerOptions output
      Serialization parameters.
    • module

      public final WebModule module
      Web module.
    • headerParams

      public final ArrayList<WebParam> headerParams
      Header Parameters.
  • Constructor Details

    • WebFunction

      protected WebFunction(StaticFunc function, WebModule module, QueryContext qc)
      Constructor.
      Parameters:
      function - associated user function
      qc - query context
      module - web module
  • Method Details

    • parse

      public abstract boolean parse(Context ctx) throws QueryException, IOException
      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.
      Parameters:
      ctx - database context
      Returns:
      true if function contains relevant annotations
      Throws:
      QueryException - query exception
      IOException - I/O exception
    • error

      protected abstract QueryException error(String msg, Object... ext)
      Creates an exception with the specified message.
      Parameters:
      msg - message
      ext - error extension
      Returns:
      exception
    • checkVariable

      protected final QNm checkVariable(String tmp, boolean... declared) throws QueryException
      Checks the specified template and adds a variable.
      Parameters:
      tmp - template string
      declared - variable declaration flags
      Returns:
      resulting variable
      Throws:
      QueryException - query exception
    • checkParsed

      protected final boolean checkParsed(boolean found, AnnList list, boolean[] declared) throws QueryException
      Checks parsed meta data.
      Parameters:
      found - found flag
      list - list of annotations
      declared - declared parameters
      Returns:
      found flag
      Throws:
      QueryException - query exception
    • checkVariable

      protected final QNm checkVariable(QNm name, boolean[] declared) throws QueryException
      Checks if the specified variable exists in the current function.
      Parameters:
      name - variable
      declared - variable declaration flags
      Returns:
      resulting variable
      Throws:
      QueryException - query exception
    • bind

      protected final void bind(QNm name, Expr[] args, Value value, QueryContext qc, String info) throws QueryException
      Binds the specified value to a variable.
      Parameters:
      name - variable name
      args - arguments
      value - value to be bound
      qc - query context
      info - info string
      Throws:
      QueryException - query exception
    • toString

      protected static String toString(Item item)
      Returns the specified item as a string.
      Parameters:
      item - item
      Returns:
      string
    • toString

      public String toString()
      Overrides:
      toString in class Object