public abstract class RestService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.ThreadLocal<InvokeConfig> |
cfg
The configuration for the last service call.
|
protected LegacyServiceParameter[] |
definitionParameters
The parameters as they appear at the target Java method, converted to
LegacyServiceParameter . |
ServiceKey |
key
The REST key.
|
LegacyService |
ls
The annotation with the details for this REST operation.
|
LegacySignature |
serviceSignature
The service signature.
|
protected int |
timeout
The invocation timeout.
|
Constructor and Description |
---|
RestService(LegacyService ls,
LegacySignature sig,
ServiceKey key,
int timeout)
Create a new instance to handle invocations for the specified REST operation.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildDefinitionParameters()
Build the parameters, from the target method's
LegacyParameter annotations. |
LegacyServiceParameter[] |
getDefinitionParameters()
Get the
definitionParameters , as they appear at the Java method's definition. |
java.lang.String |
getExecutionMode()
Get the execution mode for this service.
|
protected ArgumentsParser |
getParser(ServiceArgumentsParser argumentsParser)
Get the parser to be used for parsing the arguments, to be attached to the service's parser.
|
handle |
getProcedureHandle()
Get the persistent procedure handle set by the last call.
|
java.lang.String |
getRequestID()
Get the request ID for the last call.
|
protected ArgumentsSerializer |
getSerializer(ResponseArguments argumentsSerializer)
Get the serialized to be used for writing the response arguments.
|
abstract java.lang.Object |
invoke(AppServerHelper helper,
java.lang.String token,
java.lang.Object[] args)
Invoke this service.
|
boolean |
isPersistent()
Check if the last call of this service was for running a persistent procedure.
|
protected java.lang.String |
nextRequestId()
Compute a request ID, a 22 byte string with ':' delimiters after the 7th, 11th and 17th byte.
|
void |
reset()
Reset the last invoke
configuration . |
protected java.lang.String |
resolveModes()
Resolve the parameter modes from the
signature . |
public final ServiceKey key
public final LegacyService ls
public final LegacySignature serviceSignature
protected final int timeout
protected java.lang.ThreadLocal<InvokeConfig> cfg
protected LegacyServiceParameter[] definitionParameters
LegacyServiceParameter
.public RestService(LegacyService ls, LegacySignature sig, ServiceKey key, int timeout)
ls
- The operation details.sig
- The service signature. Non-null only for legacy services.key
- The service key.timeout
- The invocation timeout.public abstract java.lang.Object invoke(AppServerHelper helper, java.lang.String token, java.lang.Object[] args)
helper
- The appserver helper used to execute the requests.token
- When not null, it represents the token of a FWD context created for an authenticated and
authorized web service call. The API call will be performed in that context.args
- The arguments.public boolean isPersistent()
public java.lang.String getRequestID()
public handle getProcedureHandle()
public LegacyServiceParameter[] getDefinitionParameters()
definitionParameters
, as they appear at the Java method's definition.
These are built viabuildDefinitionParameters()
, depending on service's type. For legacy REST services they are built using the signature'sLegacyParameter
annotation, while for Java REST services, they are built using the Java method's signature.
public java.lang.String getExecutionMode()
public void reset()
configuration
.protected java.lang.String nextRequestId()
protected java.lang.String resolveModes()
signature
.protected ArgumentsParser getParser(ServiceArgumentsParser argumentsParser)
argumentsParser
- The service's parser.LegacyArgumentsParser
instance.protected ArgumentsSerializer getSerializer(ResponseArguments argumentsSerializer)
argumentsSerializer
- The service's serializer.LegacyArgumentsSerializer
instance.protected void buildDefinitionParameters()
LegacyParameter
annotations. This will set the
definitionParameters
array.