From df7d7981b56a4560c95ea7e9b194080e93398ecf Mon Sep 17 00:00:00 2001 From: Matt Windsor Date: Mon, 21 Mar 2011 21:54:31 +0000 Subject: GREAT PACKAGE RESHUFFLE: Everything is now organised into frontend, backend and common (to frontend and backend) packages. Things may have been broken. Doc refresh. --- doc/uk/org/ury/common/protocol/ProtocolUtils.html | 322 ++++++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 doc/uk/org/ury/common/protocol/ProtocolUtils.html (limited to 'doc/uk/org/ury/common/protocol/ProtocolUtils.html') diff --git a/doc/uk/org/ury/common/protocol/ProtocolUtils.html b/doc/uk/org/ury/common/protocol/ProtocolUtils.html new file mode 100644 index 0000000..4eec6b3 --- /dev/null +++ b/doc/uk/org/ury/common/protocol/ProtocolUtils.html @@ -0,0 +1,322 @@ + + + + + + +ProtocolUtils + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +uk.org.ury.common.protocol +
+Class ProtocolUtils

+
+java.lang.Object
+  extended by uk.org.ury.common.protocol.ProtocolUtils
+
+
+
+
public class ProtocolUtils
extends java.lang.Object
+ + +

+Utilities for converting between strings encoded in the response protocol and + collections of items, as well as validating and unpicking protocol messages. +

+ +

+

+
Author:
+
Matt Windsor
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ProtocolUtils() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.util.Map<?,?>decode(java.lang.String string) + +
+          Decode a protocol string into a key-value map.
+static java.lang.Stringencode(java.util.Map<java.lang.String,java.lang.Object> items) + +
+          Encode a key-value map into a protocol string.
+static booleanresponseIsOK(java.util.Map<?,?> response) + +
+          Check if a response is flagged as having OK status.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ProtocolUtils

+
+public ProtocolUtils()
+
+
+ + + + + + + + +
+Method Detail
+ +

+encode

+
+public static java.lang.String encode(java.util.Map<java.lang.String,java.lang.Object> items)
+
+
Encode a key-value map into a protocol string. + + The map can contain strings, lists and other maps. Other types may be + accepted by the underlying encoding engine, but the above types are the + only ones explicitly accepted. +

+

+
Parameters:
items - The key-value map of items, which should contain strings, + lists and maps. The keys of any map should be protocol + directives. +
Returns:
A string containing the encoded representation of the map.
+
+
+
+ +

+decode

+
+public static java.util.Map<?,?> decode(java.lang.String string)
+                                 throws DecodeFailureException
+
+
Decode a protocol string into a key-value map. +

+

+
Parameters:
string - The string to decode. +
Returns:
A key-value map mapping directives to strings, lists and maps. +
Throws: +
DecodeFailureException - if the decoding engine returns something other than a map.
+
+
+
+ +

+responseIsOK

+
+public static boolean responseIsOK(java.util.Map<?,?> response)
+                            throws InvalidMessageException
+
+
Check if a response is flagged as having OK status. +

+

+
Parameters:
response - The response message, as a key-value map (eg in decoded + format). +
Returns:
true if the response is flagged with OK status, false if not (eg + ERROR status). +
Throws: +
InvalidMessageException - if the response is invalid (eg the status is missing).
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + -- cgit v1.2.3