blob: 6e00c6f746ad9b8d3f3c4ef8d9c96847cf29bac7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*******************************************************************************
* Product of NIST/ITL Advanced Networking Technologies Division (ANTD). *
*******************************************************************************/
/*
* This code has been contributed by the author to the public domain.
*/
package gov.nist.javax.sip.header.extensions;
import java.text.ParseException;
import gov.nist.javax.sip.header.*;
import javax.sip.*;
import javax.sip.header.ExtensionHeader;
/**
* MinSE SIP Header.
*
* (Created by modifying Expires.java)
*
* @version JAIN-SIP-1.1 $Revision: 1.4 $ $Date: 2009/10/18 13:46:36 $
*
* @author P. Musgrave <pmusgrave@newheights.com> <br/>
*
*/
public class MinSE
extends ParametersHeader implements ExtensionHeader, MinSEHeader {
// TODO: When the MinSEHeader is added to javax - move this there...pmusgrave
public static final String NAME = "Min-SE";
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 3134344915465784267L;
/** expires field
*/
public int expires;
/** default constructor
*/
public MinSE() {
super(NAME);
}
/**
* Return canonical form.
* @return String
*/
public String encodeBody() {
String retval = Integer.toString(expires); // seems overkill - but Expires did this.
if (!parameters.isEmpty()) {
retval += SEMICOLON + parameters.encode();
}
return retval;
}
public void setValue(String value) throws ParseException {
// not implemented.
throw new ParseException(value,0);
}
/**
* Gets the expires value of the ExpiresHeader. This expires value is
*
* relative time.
*
*
*
* @return the expires value of the ExpiresHeader.
*
* @since JAIN SIP v1.1
*
*/
public int getExpires() {
return expires;
}
/**
* Sets the relative expires value of the ExpiresHeader.
* The expires value MUST be greater than zero and MUST be
* less than 2**31.
*
* @param expires - the new expires value of this ExpiresHeader
*
* @throws InvalidArgumentException if supplied value is less than zero.
*
* @since JAIN SIP v1.2
*
*/
public void setExpires(int expires) throws InvalidArgumentException {
if (expires < 0)
throw new InvalidArgumentException("bad argument " + expires);
this.expires = expires;
}
}
|