@ThreadRestricted(value="constructor") public final class StoreWAP extends Call
http://reluk.ca:8080/v/wap?wCall=sStore&sPut=mykey'myvalue&wPretty
These parameters are specific to the store API. See also the general WAP parameters. Calls are conventionally prefixed by 's'
(wCall=sStore
). If you choose a different prefix, then adjust the
parameter names below accordingly.
Key | Value | Action |
---|---|---|
sGet | A storage key, optionally followed by a guard comprising an apostrophe (') and a value as in "sGet=address'23+Main+Street". The key may not include an apostrophe, but the guard value may. The guard value may also be empty. | If no guard is specified, then it returns the currently stored value, which may be null. If a guard is specified, then the action depends on whether the guard value matches the stored value. If it matches, then the stored value is returned as usual and is also deleted from the store; otherwise null is returned and the stored value is not deleted. This is currently the only method of deleting individual values. |
sPut | A single key/value pair separated by an apostrophe ('), as in "sPut=address'23+Main+Street". If multiple apostrophes are present, then the first is taken as the separator. The key may not include an apostrophe, but the value may. The value may also be empty. | Stores the value under the key and returns the same value. |
Any of the above parameters may be specified multiple times to multiple effect. A request specifying "sGet=name&sGet=address", for example, will yield the values of both "name" and "address".
The response includes the following components. These are shown in JSON format with explanatory comments:
{ "s": { // or other prefix, per wCall query parameter "value": { // keyed values: "KEY": "VALUE", // the typical value is a string "KEY": "", // the string may be empty "KEY": null // it may also be null, meaning nothing at all is stored // and so on } } }
The response headers are set to forbid client caching and the use of stale responses. However these headers are not necessarily obeyed by all clients. Consider therefore adding a nonce to all requests as a fallback.
Modifier and Type | Field and Description |
---|---|
static String |
CALL_TYPE
The name to use in the
wCall query parameter, which is "Store". |
Constructor and Description |
---|
StoreWAP(String prefix,
Requesting req,
ResponseConfiguration resConfig)
Constructs a StoreWAP.
|
Modifier and Type | Method and Description |
---|---|
static String |
clientSignature(HttpServletRequest reqHS)
Returns the signature of the requesting client.
|
static void |
init(WAP wap) |
void |
respond(Responding res)
Responds to the call.
|
public static final String CALL_TYPE
wCall
query parameter, which is "Store". For
example: wCall=sStore
.public StoreWAP(String prefix, Requesting req, ResponseConfiguration resConfig) throws HTTPRequestException
HTTPRequestException
Call.prefix()
,
Call.req()
@ThreadSafe public static void init(WAP wap) throws ServletException
ServletException
public static String clientSignature(HttpServletRequest reqHS)
public void respond(Responding res) throws IOException
Call
respond
in class Call
IOException