+
+ /**
+ * Absolutize the hyperlink
+ * @param aPageHref Absolute page reference.
+ * @param aLinkHref Possibly relative link reference.
+ * @return Absolute hyperlink.
+ */
+ private String absolutizeHref(String aPageHref, String aLinkHref) {
+
+ try {
+ URL pageUrl = new URL(aPageHref);
+ URL newUrl = new URL(pageUrl, aLinkHref);
+ return newUrl.toString(); // TODO need to use URL instead of String throughout the code.
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("Malformed URL", e);
+ }
+ }
+
+ private NameValuePair[] getMandatoryParameters(Element aAction) {
+ List<NameValuePair> result = new ArrayList<NameValuePair>();
+ for (Element param: (List<Element>)aAction.elements(ELEM_PARAM)) {
+ String name = param.attributeValue(ATT_NAME);
+ String value = param.attributeValue(ATT_VALUE);
+ result.add(new NameValuePair(name, value));
+ }
+ return result.toArray(new NameValuePair[0]);
+ }