001: /**
002: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
003: * Unpublished - rights reserved under the Copyright Laws of the United States.
004: * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
005: * Copyright © 2005 BEA Systems, Inc. All rights reserved.
006: *
007: * Use is subject to license terms.
008: *
009: * This distribution may include materials developed by third parties.
010: *
011: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
012: *
013: * Module Name : JSIP Specification
014: * File Name : AcceptHeader.java
015: * Author : Phelim O'Doherty
016: *
017: * HISTORY
018: * Version Date Author Comments
019: * 1.1 08/10/2002 Phelim O'Doherty
020: *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
021: */package javax.sip.header;
022:
023: import javax.sip.InvalidArgumentException;
024:
025: /**
026:
027: * This interface represents an Accept request-header. It can be used in to
028:
029: * specify media-ranges which are acceptable for the response. AcceptHeaders
030:
031: * can be used to indicate that the request is specifically limited to a small
032:
033: * set of desired types. The specification of the acceptable media
034:
035: * is split into type and subtype.
036:
037: * <p>
038:
039: * An AcceptHeader may be followed by one or more parameters applicable to the
040:
041: * media-range. q-values allow the user to indicate the relative degree of
042:
043: * preference for that media-range, using the qvalue scale from 0 to 1. (If no
044:
045: * q-value is present, the media-range should be treated as having a q-value of
046:
047: * 1.)
048:
049: * <p>
050:
051: * If no AcceptHeader is present in a Request, the server SHOULD assume a media
052: * of type "application" and subType
053:
054: * "sdp". If an AcceptHeader is present, and if the server cannot send a
055:
056: * response which is acceptable according to the combined Accept field value,
057:
058: * then the server should send a Response message with a NOT_ACCEPTABLE
059:
060: * status code.
061:
062: * <p>
063: * For example:<br>
064: * <code>Accept: application/sdp;level=1, application/x-private, text/html</code>
065: *
066: * @author BEA Systems, NIST
067: * @version 1.2
068: *
069: */
070: public interface AcceptHeader extends MediaType, Parameters, Header {
071:
072: /**
073: * Sets q-value for media-range in AcceptHeader. Q-values allow the user to
074: * indicate the relative degree of preference for that media-range, using
075:
076: * the qvalue scale from 0 to 1. If no q-value is present, the media-range
077:
078: * should be treated as having a q-value of 1.
079:
080: *
081:
082: * @param qValue - the new float value of the q-value, a value of -1 resets
083:
084: * the qValue.
085:
086: * @throws InvalidArgumentException if the q parameter value is not
087:
088: * <code>-1</code> or between <code>0 and 1</code>.
089:
090: */
091:
092: public void setQValue(float qValue) throws InvalidArgumentException;
093:
094: /**
095:
096: * Gets q-value of media-range in AcceptHeader. A value of <code>-1</code>
097:
098: * indicates the<code>q-value</code> is not set.
099:
100: *
101:
102: * @return q-value of media-range, -1 if q-value is not set.
103:
104: */
105:
106: public float getQValue();
107:
108: /**
109:
110: * Gets boolean value to indicate if the AcceptHeader allows all media
111:
112: * sub-types, that is the content sub-type is "*".
113:
114: *
115:
116: * @return true if all content sub-types are allowed, false otherwise.
117:
118: */
119:
120: public boolean allowsAllContentSubTypes();
121:
122: /**
123:
124: * Gets boolean value to indicate if the AcceptHeader allows all media
125:
126: * types, that is the content type is "*".
127:
128: *
129:
130: * @return true if all contenet types are allowed, false otherwise.
131:
132: */
133:
134: public boolean allowsAllContentTypes();
135:
136: /**
137:
138: * Name of AcceptHeader
139:
140: */
141:
142: public final static String NAME = "Accept";
143:
144: }
|