Package org.basex.http.web
Class WebResponse
- java.lang.Object
-
- org.basex.http.web.WebResponse
-
- Direct Known Subclasses:
WsResponse
public abstract class WebResponse extends Object
This abstract class defines common methods of Web responses.- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWebResponse.ResponseResponse type.
-
Field Summary
Fields Modifier and Type Field Description protected ContextctxDatabase context.protected QueryContextqcQuery context.
-
Constructor Summary
Constructors Modifier Constructor Description protectedWebResponse(Context ctx)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WebResponse.Responsecreate(WebFunction function, Object data, boolean body)Creates the Response.protected abstract Expr[]init(WebFunction function, Object data)Initializes the evaluation of the specified function and binds function arguments.protected abstract WebResponse.Responseserialize(boolean body)Serializes the response.
-
-
-
Field Detail
-
ctx
protected final Context ctx
Database context.
-
qc
protected QueryContext qc
Query context.
-
-
Constructor Detail
-
WebResponse
protected WebResponse(Context ctx)
Constructor.- Parameters:
ctx- database context
-
-
Method Detail
-
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
protected abstract Expr[] init(WebFunction function, Object data) throws QueryException, IOException
Initializes the evaluation of the specified function and binds function arguments.- Parameters:
function- web functiondata- additional data (result, function, error, can benull)- Returns:
- function arguments
- 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
-
-