Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.clearspace
Class WSUtils

    java.lang.Object
      org.jivesoftware.openfire.clearspace.WSUtils

    public class WSUtils

extends Object

Several utilities to handle REST webservices.

Constructor Summary
`WSUtils()`

Method Summary
`static String` | `formatDate(Date date)` Formats a date into yyyy-MM-dd'T'HH:mm:ss.SSSZ, for example 2008-02-13T18:54:29.147-03:00
`protected static String` | `getElementText(org.dom4j.Node node, String name)` Returns the text of the first an element with name 'name'.
`protected static String` | `getReturn(org.dom4j.Element element)` Returns the text of the first an element with name 'return'.
`protected static String` | `marshallList(List<String> data)`
`protected static void` | `modifyElementText(org.dom4j.Element element, String[] path, String newValue)`
`protected static void` | `modifyElementText(org.dom4j.Node node, String name, String newValue)` Modifies the text of the elmement with name 'name'.
`static Date` | `parseDate(String date)` Parses a date of the form 1969-12-31T21:00:00-03:00, or 2008-02-13T18:54:29.147-03:00.
`protected static List<String>` | `parseStringArray(org.dom4j.Element element)` Parse REST responses of the type String[], that are XML of the form: text1 text2 text3
`protected static List<String>` | `parseUsernameArray(org.dom4j.Element element)` Parse REST responses of the type String[] that represent usernames, that are XML of the form: text1 text2 text3

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WSUtils

    public WSUtils()

Method Detail

### getReturn

    protected static String getReturn(org.dom4j.Element element)

  Returns the text of the first an element with name 'return'.

  Parameters:
    `element` - the element to search for a return element.
  Returns:
    the text of the return element.

### getElementText

    protected static String getElementText(org.dom4j.Node node,
                                           String name)

  Returns the text of the first an element with name 'name'.

  Parameters:
    `node` - the element to search for a "name" element.
    `name` - the name of the element to search
  Returns:
    the text of the corresponding element

### modifyElementText

    protected static void modifyElementText(org.dom4j.Node node,
                                            String name,
                                            String newValue)

  Modifies the text of the elmement with name 'name'.

  Parameters:
    `node` - the element to search
    `name` - the name to search
    `newValue` - the new value of the text

### modifyElementText

    protected static void modifyElementText(org.dom4j.Element element,
                                            String[] path,
                                            String newValue)

### parseStringArray

    protected static List<String> parseStringArray(org.dom4j.Element element)

  Parse REST responses of the type String[], that are XML of the form:

  text1 text2 text3

  Parameters:
    `element` - Element from REST response to be parsed.
  Returns:
    An array of strings from the REST response.

### parseUsernameArray

    protected static List<String> parseUsernameArray(org.dom4j.Element element)

  Parse REST responses of the type String[] that represent usernames, that are XML of the form:

  text1 text2 text3

  Parameters:
    `element` - Element from REST response to be parsed.
  Returns:
    An array of strings from the REST response.

### marshallList

    protected static String marshallList(List<String> data)

### parseDate

    public static Date parseDate(String date)

  Parses a date of the form 1969-12-31T21:00:00-03:00, or 2008-02-13T18:54:29.147-03:00. If the string is null or there is a problem parsing the date, returns null.

  Parameters:
    `date` - the string to parse
  Returns:
    the corresponding date, or null if t

### formatDate

    public static String formatDate(Date date)

  Formats a date into yyyy-MM-dd'T'HH:mm:ss.SSSZ, for example 2008-02-13T18:54:29.147-03:00

  Parameters:
    `date` - the date to format
  Returns:
    a string representation of the date

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.7.1 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.