/**
  * Returns the portlet URL string representation to be embedded in the markup.<br>
  * Note that the returned String may not be a valid URL, as it may be rewritten by the
  * portal/portlet-container before returning the markup to the client.
  *
  * @return the encoded URL as a string
  */
 @Override
 public String toString() {
   String portletURLString = getChannelURL().toString();
   if (this.escapeXml != null && this.escapeXml.booleanValue()) {
     return URLHelper.escapeURL(portletURLString);
   } else {
     return portletURLString;
   }
 }
 /**
  * Writes the portlet URL to the output stream using the provided writer. If the parameter
  * escapeXML is set to true the URL will be escaped to be valid XML characters, i.e. &lt, &gt,
  * &amp, &#039, &#034 will get converted into their corresponding character entity codes (&lt to
  * &&lt, &gt to &&gt, &amp to &&amp, &#039 to &&#039, &#034 to &&#034). If escapeXML is set to
  * flase no escaping will be done.
  *
  * <p>Note that the URL written to the output stream may not be a valid URL, as it may be
  * rewritten by the portal/portlet-container before returning the markup to the client.
  *
  * @param out the writer to write the portlet URL to
  * @param escapeXML denotes if the URL should be XML escaped before written to the output stream
  *     or not
  * @throws java.io.IOException if an I/O error occured while writing the URL
  * @since 2.0
  */
 public void write(Writer out, boolean escapeXML) throws IOException {
   String urlString = toString();
   if (this.escapeXml != null) {
     escapeXML = this.escapeXml.booleanValue();
   }
   if (escapeXML) {
     urlString = URLHelper.escapeURL(urlString);
   }
   out.write(urlString);
 }