Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement
 *
 * .
 *
 */
Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * /
 
 
 package gov.nist.javax.sip.header;
 
 import javax.sip.*;
Retry-After SIP Header.

Author(s):
M. Ranganathan
Olivier Deruelle
Version:
1.2 $Revision: 1.9 $ $Date: 2009/11/04 17:35:55 $
 
 public class RetryAfter extends ParametersHeader implements RetryAfterHeader {

    
Comment for serialVersionUID
 
     private static final long serialVersionUID = -1029458515616146140L;

    
constant DURATION parameter.
 
     public static final String DURATION = .;

    
duration field
 
     protected Integer retryAfter = new Integer(0);

    
comment field
 
     protected String comment;

    
Default constructor
 
     public RetryAfter() {
         super();
     }

    
Encode body of this into cannonical form.

Returns:
encoded body
 
     public String encodeBody() {
         StringBuffer s = new StringBuffer();
         
         if ( != null)
             s.append();
 
         if ( != null)
             s.append( +  +  + );
 
         if (!.isEmpty()) {
             s.append( + .encode());
         }
 
         return s.toString();
     }

    
Boolean function

Returns:
true if comment exist, false otherwise
 
     public boolean hasComment() {
         return  != null;
     }

    
remove comment field
 
     public void removeComment() {
         = null;
    }

    
remove duration field
    public void removeDuration() {
        super.removeParameter();
    }

    
Sets the retry after value of the RetryAfterHeader. The retry after value MUST be greater than zero and MUST be less than 2**31.

Parameters:
retryAfter - the new retry after value of this RetryAfterHeader
Throws:
javax.sip.InvalidArgumentException if supplied value is less than zero.
    public void setRetryAfter(int retryAfterthrows InvalidArgumentException {
        if (retryAfter < 0)
            throw new InvalidArgumentException(
                "invalid parameter " + retryAfter);
        this. = Integer.valueOf(retryAfter);
    }

    
Gets the retry after value of the RetryAfterHeader. This retry after value is relative time.

Returns:
the retry after value of the RetryAfterHeader.
    public int getRetryAfter() {
        return .intValue();
    }

    
Gets the comment of RetryAfterHeader.

Returns:
the comment of this RetryAfterHeader, return null if no comment is available.
    public String getComment() {
        return ;
    }

    
Sets the comment value of the RetryAfterHeader.

Parameters:
comment - the new comment string value of the RetryAfterHeader.
Throws:
java.text.ParseException which signals that an error has been reached unexpectedly while parsing the comment.
    public void setComment(String commentthrows ParseException {
        if (comment == null)
            throw new NullPointerException("the comment parameter is null");
        this. = comment;
    }

    
Sets the duration value of the RetryAfterHeader. The retry after value MUST be greater than zero and MUST be less than 2**31.

Parameters:
duration - the new duration value of this RetryAfterHeader
Throws:
javax.sip.InvalidArgumentException if supplied value is less than zero.
    public void setDuration(int durationthrows InvalidArgumentException {
        if (duration < 0)
            throw new InvalidArgumentException("the duration parameter is <0");
        this.setParameter(duration);
    }

    
Gets the duration value of the RetryAfterHeader. This duration value is relative time.

Returns:
the duration value of the RetryAfterHeader, return zero if not set.
    public int getDuration() {
      if (this.getParameter() == nullreturn -1;
      else return super.getParameterAsInt();
    }
New to GrepCode? Check out our FAQ X