Package org.basex.http.restxq
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-23, BSD License, Christian Gruen
-
-
Field Summary
Fields Modifier and Type Field Description org.basex.http.restxq.RestXqPathpathPath (can benull).ArrayList<MediaType>producesReturned media types.-
Fields inherited from class org.basex.http.web.WebFunction
function, headerParams, module, sopts
-
-
Constructor Summary
Constructors Constructor Description RestXqFunction(StaticFunc function, WebModule module, QueryContext qc)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(WebFunction func)MediaTypeconsumedType(MediaType type)Returns the most specific consume type for the specified type.QueryExceptionerror(String msg, Object... ext)Creates an exception with the specified message.booleanmatches(HTTPConnection conn, QNm err, boolean perm)Checks if an HTTP request matches this function and its constraints.booleanparseAnnotations(Context ctx)Checks a function for REST and permission annotations.StringtoString()-
Methods inherited from class org.basex.http.web.WebFunction
bind, checkParsed, checkVariable, checkVariable, toString
-
-
-
-
Constructor Detail
-
RestXqFunction
public RestXqFunction(StaticFunc function, WebModule module, QueryContext qc)
Constructor.- Parameters:
function- associated user functionmodule- web moduleqc- query context
-
-
Method Detail
-
parseAnnotations
public boolean parseAnnotations(Context ctx) throws QueryException, IOException
Description copied from class:WebFunctionChecks 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:
parseAnnotationsin classWebFunction- Parameters:
ctx- database context- Returns:
trueif function contains relevant annotations- Throws:
QueryException- query exceptionIOException- 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 connectionerr- 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:WebFunctionCreates an exception with the specified message.- Specified by:
errorin classWebFunction- Parameters:
msg- messageext- error extension- Returns:
- exception
-
compareTo
public int compareTo(WebFunction func)
-
toString
public String toString()
- Overrides:
toStringin classWebFunction
-
-