@ThreadRestricted(value="constructor") @Uncached public final class CountWAP extends Call
wCall=cCount
). If you choose a different
prefix, then adjust the parameter names below accordingly. An example request is:
http://reluk.ca:8080/v/wap?wCall=cCount&cPoll=G%2Fp%2Fsandbox&cBase&wPretty
These parameters are specific to the count engine API. See also the general WAP parameters.
Key | Value | Default |
---|---|---|
cBase | Specify 'cBase' or 'cBase=y' to request the base components of the count. At present these are the baseCandidates and superaccounts. | n |
cGroup | Mailish usernames of candidates separated by left parentheses '(', as in "cGroup=Jack-ThisOrg(Jill-ThatNet". The response will included the nodes of each specified candidate plus any direct, dart sectored voters of that candidate. | Null, optional item. |
cPoll | Names the poll. | None, a value is required. |
Long integers (64 bit) are specified in string form, allowing JavaScript clients (normally limited to 53 bits) to parse even the largest of them by whatever extended means is available to each. The overall response includes the following components. These are shown in JSON format with explanatory comments:
{ "c": { // or other prefix, per wCall query parameter "poll": { // only a single poll at present: "POLL-NAME": { "error": { // Client-actionable errors. This only appears if errors were // detected, in which case they will be the total of the response. "noCountToReport": {} // No count is currently reported for the poll. }, "baseCandidates": [ // Usernames of base candidates. This only appears if requested by // parameter 'cBase'. It names only those candidates who are dart // sectored. Use the names to look up the corresponding nodes. "CANDIDATE-NAME", "CANDIDATE-NAME" // and so on, up to 20 ], "nodes": { // Count nodes keyed by username: "NAME 1": { // empty unless node actually counted, in which case: "candidateName": CANDIDATE NAME, // if any "dartSector": DART SECTOR, "directVoterCount": "DIRECT VOTER COUNT", // stringified long "displayTitle": DISPLAY TITLE, // if any "isCycler": IS CYCLER, "registers": { // Superaccount registers for the node, indexed first by the page // name of the counting method, then by the account name. If a // given superaccount's register is not included, then none of // its pledges flowed to or from this node. The "Votes" register // is always included. "Wiki:Vote count": { "Votes": { "carryVolume": "CARRY VOLUME", // stringified longs "receiveVolume": "RECEIVE VOLUME", "castVolume": "CAST VOLUME", "targetVolume": "TARGET VOLUME" // optional, personally defined // by the node. Not yet implemented } }, "Wiki:Quantitive summation": { // these registers are only simulated at present "ACCOUNT NAME 1": { "accountPage": "ACCOUNT", // relative path, only if an // account defined for this node. Not yet implemented. "carryVolume": "CARRY VOLUME", // stringified longs "castVolume": "CAST VOLUME", "receiveVolume": "RECEIVE VOLUME", "targetVolume": "TARGET VOLUME" // optional, personally defined // by the node. Not yet implemented. }, "ACCOUNT NAME 2": { // as above } } // and so on }, "voters": [ // Usernames of direct voters, if any. This list only appears if // NAME 1 was specified in parameter 'cGroup', and only if there // are direct voters. In that case, it names only those voters // who are dart sectored. Use the names to look up the // corresponding nodes. "VOTER-NAME", "VOTER-NAME" // and so on, up to 20 ] }, "NAME 2" { // as above } // and so on }, "superaccounts": { // Resource superaccounts for the entire count, indexed first by the // page name of the counting method, then by the account name. This // only appears if requested by parameter 'cBase'. "Wiki:Vote count": { "Votes": { "castVolume": "CAST VOLUME" // stringified long // The total weight of votes cast. This is equal to the total // weight held. } }, "Wiki:Quantitive summation": { "ACCOUNT NAME 1": { "castVolume": "CAST VOLUME" // stringified long }, "ACCOUNT NAME 2": { // as above } // and so on, for all superaccounts using quantitative summation } }, "uiString": UI-STRING // A timestamped identifier based on count.readyDirectory().toUIString(). // Combined with the poll name, it forms a unique identifier for the // count within the scope of the local vote-server. } } } }
For a baseline reference, here is a minimal pretty request together with the
corresponding response:
http://reluk.ca:8080/v/wap?wCall=cCount&cPoll=G%2Fp%2Fsandbox&wPretty
{ "c": { "poll": { "G/p/sandbox": { "nodes": {}, "uiString": "snap-2011-54-5/readyCount-1" } } } }
Modifier and Type | Field and Description |
---|---|
static String |
CALL_TYPE
The name to use in the
wCall query parameter, which is "Count". |
Constructor and Description |
---|
CountWAP(String prefix,
Requesting req,
ResponseConfiguration resConfig)
Constructs a CountWAP.
|
Modifier and Type | Method and Description |
---|---|
void |
respond(Responding res)
Responds to the call.
|
public static final String CALL_TYPE
wCall
query parameter, which is "Count". For
example: wCall=cCount
.public CountWAP(String prefix, Requesting req, ResponseConfiguration resConfig) throws HTTPRequestException
HTTPRequestException
Call.prefix()
,
Call.req()
public void respond(Responding res) throws IOException
Call
respond
in class Call
IOException