Class RestXqFunction

java.lang.Object
org.basex.http.web.WebFunction
org.basex.http.restxq.RestXqFunction
All Implemented Interfaces:
Comparable<WebFunction>

public final class RestXqFunction extends WebFunction
This class represents a single RESTXQ function.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • produces

      public final ArrayList<MediaType> produces
      Returned media types.
    • path

      public org.basex.http.restxq.RestXqPath path
      Path (can be null).
  • Constructor Details

    • RestXqFunction

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

    • parse

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

      public void bind(Expr[] args, Object ext, HTTPConnection conn, QueryContext qc) throws QueryException, IOException
      Binds the annotated variables.
      Parameters:
      args - arguments
      ext - extended processing information (can be null)
      conn - HTTP connection
      qc - query context
      Throws:
      QueryException - exception
      IOException - I/O exception
    • matches

      public boolean matches(HTTPConnection conn, QNm err, boolean perm)
      Checks if an HTTP request matches this function and its constraints.
      Parameters:
      conn - HTTP connection
      err - error code (assigned if error function is to be called)
      perm - permission flag
      Returns:
      result of check
    • consumedType

      public MediaType consumedType(MediaType type)
      Returns the most specific consume type for the specified type.
      Parameters:
      type - media type
      Returns:
      most specific type
    • error

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

      public int compareTo(WebFunction func)
    • toString

      public String toString()
      Overrides:
      toString in class WebFunction