Home | History | Annotate | Download | only in ims
      1 /*
      2 * Conditions Of Use
      3 *
      4 * This software was developed by employees of the National Institute of
      5 * Standards and Technology (NIST), an agency of the Federal Government.
      6 * Pursuant to title 15 Untied States Code Section 105, works of NIST
      7 * employees are not subject to copyright protection in the United States
      8 * and are considered to be in the public domain.  As a result, a formal
      9 * license is not needed to use the software.
     10 *
     11 * This software is provided by NIST as a service and is expressly
     12 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
     13 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
     14 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
     15 * AND DATA ACCURACY.  NIST does not warrant or make any representations
     16 * regarding the use of the software or the results thereof, including but
     17 * not limited to the correctness, accuracy, reliability or usefulness of
     18 * the software.
     19 *
     20 * Permission to use this software is contingent upon your acceptance
     21 * of the terms of this agreement
     22 *
     23 * .
     24 *
     25 */
     26 /*******************************************
     27  * PRODUCT OF PT INOVACAO - EST DEPARTMENT *
     28  *******************************************/
     29 
     30 package gov.nist.javax.sip.header.ims;
     31 
     32 import java.text.ParseException;
     33 
     34 import javax.sip.header.ExtensionHeader;
     35 
     36 import gov.nist.javax.sip.address.AddressImpl;
     37 import gov.nist.javax.sip.header.ims.PathHeader;
     38 
     39 /**
     40  * @author ALEXANDRE MIGUEL SILVA SANTOS - N 10045401
     41  */
     42 
     43 public class Path
     44     extends gov.nist.javax.sip.header.AddressParametersHeader
     45     implements PathHeader, SIPHeaderNamesIms , ExtensionHeader{
     46 
     47     /**
     48      * constructor
     49      * @param address address to set
     50      */
     51     public Path(AddressImpl address) {
     52         super(NAME);
     53         this.address = address;
     54     }
     55 
     56     /**
     57      * default constructor
     58      */
     59     public Path()
     60     {
     61         // issued by Miguel Freitas
     62         super(NAME);
     63 
     64     }
     65 
     66     /** Encode into canonical form.
     67      *@return String containing the canonicaly encoded header.
     68      */
     69     public String encodeBody() {
     70         StringBuffer retval = new StringBuffer();
     71         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
     72             retval.append(LESS_THAN);
     73         }
     74         retval.append(address.encode());
     75         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
     76             retval.append(GREATER_THAN);
     77         }
     78 
     79         if (!parameters.isEmpty())
     80             retval.append(SEMICOLON + this.parameters.encode());
     81         return retval.toString();
     82     }
     83 
     84     public void setValue(String value) throws ParseException {
     85         throw new ParseException(value,0);
     86 
     87     }
     88 
     89 }
     90