Home | History | Annotate | Download | only in header
      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 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
     26 *******************************************************************************/
     27 package gov.nist.javax.sip.header;
     28 
     29 import javax.sip.header.*;
     30 import java.text.ParseException;
     31 
     32 /**
     33  * the SIP-ETag header.
     34  *
     35  * @author Jeroen van Bemmel<br/>
     36  * @version 1.2 $Revision: 1.3 $ $Date: 2009/07/17 18:57:37 $
     37  * @since 1.2
     38  */
     39 public class SIPETag extends SIPHeader implements SIPETagHeader , ExtensionHeader{
     40 
     41     /**
     42      * Comment for <code>serialVersionUID</code>
     43      */
     44     private static final long serialVersionUID = 3837543366074322107L;
     45 
     46     /**
     47      * entity tag field
     48      */
     49     protected String entityTag;
     50 
     51     /** Default constructor
     52      */
     53     public SIPETag() {
     54         super(NAME);
     55     }
     56 
     57     public SIPETag( String tag ) throws ParseException {
     58         this();
     59         this.setETag( tag );
     60     }
     61 
     62 
     63     /**
     64      * Encode into canonical form.
     65      * @return String
     66      */
     67     public String encodeBody() {
     68         return entityTag;
     69     }
     70 
     71     /**
     72      * get the priority value.
     73      * @return String
     74      */
     75     public String getETag() {
     76         return entityTag;
     77     }
     78 
     79     /**
     80      * Set the priority member
     81      * @param etag String to set
     82      */
     83     public void setETag(String etag) throws ParseException {
     84         if (etag == null)
     85             throw new NullPointerException(
     86                 "JAIN-SIP Exception,"
     87                     + "SIP-ETag, setETag(), the etag parameter is null");
     88         this.entityTag = etag;
     89     }
     90 
     91     /**
     92      * This method needs to be added for backwards compatibility to
     93      * avoid ClassCast exception on V1.1 applications
     94      *
     95      * @see javax.sip.header.ExtensionHeader#setValue(java.lang.String)
     96      */
     97     public void setValue(String value) throws ParseException {
     98         this.setETag(value);
     99 
    100     }
    101 }
    102