Example #1
0
 /**
  * Returns the host part of this ViaHeader.
  *
  * @return the string value of the host
  */
 public String getHost() {
   if (sentBy == null) return null;
   else {
     Host host = sentBy.getHost();
     if (host == null) return null;
     else return host.getHostname();
   }
 }
Example #2
0
  /**
   * Sets the value of the <code>maddr</code> parameter of this ViaHeader. The maddr parameter
   * indicates the server address to be contacted for this user, overriding any address derived from
   * the host field.
   *
   * @param mAddr new value of the <code>maddr</code> parameter
   * @throws ParseException which signals that an error has been reached unexpectedly while parsing
   *     the mAddr value.
   */
  public void setMAddr(String mAddr) throws ParseException {
    if (mAddr == null)
      throw new NullPointerException(
          "JAIN-SIP Exception, " + "Via, setMAddr(), the mAddr parameter is null.");

    Host host = new Host();
    host.setAddress(mAddr);
    NameValue nameValue = new NameValue(ParameterNames.MADDR, host);
    setParameter(nameValue);
  }