Package org.basex.http.web
Class WebModules
- java.lang.Object
-
- org.basex.http.web.WebModules
-
public final class WebModules extends Object
This class caches RESTXQ modules found in the HTTP root directory.- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<RestXqFunction>checks(HTTPConnection conn)Returns permission functions that match the current request.ArrayList<WsFunction>findWs(WebSocket ws, Annotation ann)Returns all implementations for the given WebSocket.static WebModulesget(Context ctx)Returns the singleton instance.voidinit(boolean update)Initializes the module cache.RestXqFunctionrestxq(HTTPConnection conn, QNm error)Returns a RESTXQ function that matches the current request or the specified error code best.FNodewadl(javax.servlet.http.HttpServletRequest request, Context ctx)Returns a WADL description for all available URIs.WsFunctionwebsocket(WebSocket ws, Annotation ann)Returns the WebSocket function that matches the current request.
-
-
-
Method Detail
-
get
public static WebModules get(Context ctx)
Returns the singleton instance.- Parameters:
ctx- database context- Returns:
- instance
-
init
public void init(boolean update)
Initializes the module cache.- Parameters:
update- only update new modules
-
wadl
public FNode wadl(javax.servlet.http.HttpServletRequest request, Context ctx) throws QueryException
Returns a WADL description for all available URIs.- Parameters:
request- HTTP requestctx- database context- Returns:
- WADL description
- Throws:
QueryException- query exception
-
restxq
public RestXqFunction restxq(HTTPConnection conn, QNm error) throws QueryException, IOException
Returns a RESTXQ function that matches the current request or the specified error code best.- Parameters:
conn- HTTP connectionerror- error code (assigned if error function is to be called)- Returns:
- function, or
nullif no function matches - Throws:
QueryException- query exceptionIOException- I/O exception
-
checks
public List<RestXqFunction> checks(HTTPConnection conn) throws QueryException, IOException
Returns permission functions that match the current request.- Parameters:
conn- HTTP connection- Returns:
- list of function, ordered by relevance
- Throws:
QueryException- query exceptionIOException- I/O exception
-
findWs
public ArrayList<WsFunction> findWs(WebSocket ws, Annotation ann) throws QueryException, IOException
Returns all implementations for the given WebSocket.- Parameters:
ws- WebSocketann- annotation (can benull)- Returns:
- result of check
- Throws:
QueryException- query exceptionIOException- I/O exception
-
websocket
public WsFunction websocket(WebSocket ws, Annotation ann) throws QueryException, IOException
Returns the WebSocket function that matches the current request.- Parameters:
ws- WebSocketann- annotation- Returns:
- function, or
nullif no function matches - Throws:
QueryException- query exceptionIOException- I/O exception
-
-