public abstract class ServiceCall extends Object
StructuredService
Modifier and Type | Field and Description |
---|---|
protected WebContext |
ctx |
protected static sirius.kernel.health.Log |
LOG |
Modifier | Constructor and Description |
---|---|
protected |
ServiceCall(WebContext ctx) |
Modifier and Type | Method and Description |
---|---|
protected abstract sirius.kernel.xml.StructuredOutput |
createOutput()
Creates the output used to render the result of the service call.
|
sirius.kernel.commons.Value |
get(String... keys)
Returns the value provided for the given key(s).
|
WebContext |
getContext()
Provides access to the underlying request.
|
List<String> |
getParameters(String... keys)
Returns all query string or POST parameters provided for the given key(s).
|
sirius.kernel.health.HandledException |
handle(Throwable error)
Handles the given exception by creating an error response.
|
protected void |
invoke(StructuredService serv)
Calls the given service.
|
void |
markCallFailed(sirius.kernel.xml.StructuredOutput out,
String message)
Marks the call as failed by adding the well known error, successfalse and message
properties to the given output.
|
void |
markCallSuccessful(sirius.kernel.xml.StructuredOutput out)
Marks the call as failed by adding the well known error and successfalse
properties to the given output.
|
sirius.kernel.commons.Value |
require(String... keys)
Returns the value provided for the given key(s) or reports an error if no non empty value was found.
|
protected static final sirius.kernel.health.Log LOG
protected WebContext ctx
protected ServiceCall(WebContext ctx)
public sirius.kernel.health.HandledException handle(Throwable error)
error
- the exception to reportHandledException
the handled Exceptionpublic void markCallFailed(sirius.kernel.xml.StructuredOutput out, String message)
out
- the output to write tomessage
- the message to reportpublic void markCallSuccessful(sirius.kernel.xml.StructuredOutput out)
out
- the output to write topublic WebContext getContext()
public sirius.kernel.commons.Value get(String... keys)
The first non empty value is used. If all values are empty, an empty value is returned.
keys
- the keys to check for a valuepublic List<String> getParameters(String... keys)
If no parameters are found, an empty list is returned.
keys
- the keys to check for parameterspublic sirius.kernel.commons.Value require(String... keys)
The first non empty value is used. If all values are empty, an exception is thrown.
keys
- the keys to check for a valueprotected void invoke(StructuredService serv)
serv
- the service to callprotected abstract sirius.kernel.xml.StructuredOutput createOutput()
Copyright © 2018. All rights reserved.