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;
 
Accept header : The top level header is actually AcceptList which is a list of Accept headers.

Author(s):
M. Ranganathan
Version:
1.2 $Revision: 1.10 $ $Date: 2010-05-06 14:07:54 $
Since:
1.1
 
 public final class Accept
     extends ParametersHeader
     implements javax.sip.header.AcceptHeader {

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

    
mediaRange field
 
     protected MediaRange mediaRange;

    
default constructor
 
     public Accept() {
         super();
     }

    
returns true if this header allows all ContentTypes, false otherwise.

Returns:
Boolean
 
     public boolean allowsAllContentTypes() {
         if ( == null)
             return false;
         else
             return ..compareTo() == 0;
     }

    
returns true if this header allows all ContentSubTypes, false otherwise.

Returns:
boolean
 
     public boolean allowsAllContentSubTypes() {
         if ( == null) {
             return false;
         } else
             return .getSubtype().compareTo() == 0;
     }

    
Encode the value of this header into cannonical form.

Returns:
encoded value of the header as a string.
 
     protected String encodeBody() {
         return encodeBody(new StringBuilder()).toString();
     }
 
     protected StringBuilder encodeBody(StringBuilder buffer) {
         if ( != null)
             .encode(buffer);
         if ( != null && !.isEmpty()) {
             buffer.append(';');
            .encode(buffer);
        }
        return buffer;
    }

    
get the MediaRange field

Returns:
MediaRange
    public MediaRange getMediaRange() {
        return ;
    }

    
get the contentType field

Returns:
String
    public String getContentType() {
        if ( == null)
            return null;
        else
            return .getType();
    }

    
get the ContentSubType fiels

Returns:
String
    public String getContentSubType() {
        if ( == null)
            return null;
        else
            return .getSubtype();
    }

    
Get the q value.

Returns:
float
    public float getQValue() {
        return getParameterAsFloat(.);
    }

    
Return true if the q value has been set.

Returns:
boolean
    public boolean hasQValue() {
        return super.hasParameter(.);
    }

    
Remove the q value.
    public void removeQValue() {
        super.removeParameter(.);
    }

    
set the ContentSubType field

Parameters:
subtype String to set
    public void setContentSubType(String subtype) {
        if ( == null)
             = new MediaRange();
        .setSubtype(subtype);
    }

    
set the ContentType field

Parameters:
type String to set
    public void setContentType(String type) {
        if ( == null)
             = new MediaRange();
        .setType(type);
    }

    
Set the q value

Parameters:
qValue float to set
Throws:
java.lang.IllegalArgumentException if qValue is <0.0 or >1.0
    public void setQValue(float qValuethrows InvalidArgumentException {
        if (qValue == -1)
            super.removeParameter(.);
        super.setParameter(.qValue);
    }

    
Set the mediaRange member

Parameters:
m MediaRange field
    public void setMediaRange(MediaRange m) {
         = m;
    }
    public Object clone() {
        Accept retval = (Acceptsuper.clone();
        if (this. != null)
            retval.mediaRange = (MediaRangethis..clone();
        return retval;
    }
New to GrepCode? Check out our FAQ X