Package org.basex.http.web
Class WebResponse
java.lang.Object
org.basex.http.web.WebResponse
- Direct Known Subclasses:
WsResponse
This abstract class defines common methods of Web responses.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ContextDatabase context.protected QueryContextQuery context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidBinds values to the function parameters.final WebResponse.Responsecreate(WebFunction function, Object data, boolean body) Creates the Response.protected abstract voidinit(WebFunction function) Creates and returns a function instance that can be evaluated.protected abstract WebResponse.Responseserialize(boolean body) Serializes the response.
-
Field Details
-
ctx
Database context. -
qc
Query context.
-
-
Constructor Details
-
WebResponse
Constructor.- Parameters:
ctx- database context
-
-
Method Details
-
create
public final WebResponse.Response create(WebFunction function, Object data, boolean body) throws QueryException, IOException, javax.servlet.ServletException Creates the Response.- Parameters:
function- function to be evaluateddata- additional data (result, function, error, can benull)body- serialize body- Returns:
- response type
- Throws:
IOException- I/O ExceptionQueryException- query exceptionjavax.servlet.ServletException- servlet exception
-
init
Creates and returns a function instance that can be evaluated.- Parameters:
function- function template- Throws:
QueryException- query exceptionIOException- I/O exception
-
bind
Binds values to the function parameters.- Parameters:
args- argumentsdata- additional data (result, function, error, can benull)- Throws:
QueryException- query exceptionIOException- I/O exception
-
serialize
protected abstract WebResponse.Response serialize(boolean body) throws QueryException, IOException, javax.servlet.ServletException Serializes the response.- Parameters:
body- serialize body (iffalse, only the headers will be assigned)- Returns:
- response type
- Throws:
QueryException- query exceptionIOException- I/O exceptionjavax.servlet.ServletException- servlet exception
-