From LongJump Support Wiki

Jump to: navigation, search

The BaseUtil class contains methods that are useful when generating requests and processing responses in a subclass of BaseClient.


Tip: The file contains this utility class, BaseClient (which uses), and extensions to BaseClient that demonstrate REST operations.

prettyPrint(InputStream xml_in)
Displays nicely-formatted, indented XML.
prettyPrint(MultivaluedMap<String,String> map)
Pretty print a map of key/value pairs, where both the keys and the values are strings, and each key maps to a list of one or more string values. Lists are displayed in the form:
[item1, item2, ...]
xpath_result(String xpath_expr, String xml)
Given an XPath expression and an XML string, returns a string with the corresponding value from the XML. So for <platform><message><status>200</status>..., the XPath expression "/platform/message/status" returns "200".
mediaType(String filename)
Examines a filename's extension and returns a string with the appropriate MIME type for that kind of a file, so it can be inserted into a header. For example, if the extension is ".txt", it returns "text/plain".
Personal tools