1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.fourthline.cling.model.message.header;
17
18 import org.fourthline.cling.model.types.UDN;
19
20
21
22
23 public class UDNHeader extends UpnpHeader<UDN> {
24
25 public UDNHeader() {
26 }
27
28 public UDNHeader(UDN udn) {
29 setValue(udn);
30 }
31
32 public void setString(String s) throws InvalidHeaderException {
33 if (!s.startsWith(UDN.PREFIX)) {
34 throw new InvalidHeaderException("Invalid UDA header value, must start with '"+UDN.PREFIX+"': " + s);
35 }
36
37 if (s.contains("::urn")) {
38 throw new InvalidHeaderException("Invalid UDA header value, must not contain '::urn': " + s);
39 }
40
41 UDN udn = new UDN( s.substring(UDN.PREFIX.length()) );
42 setValue(udn);
43 }
44
45 public String getString() {
46 return getValue().toString();
47 }
48 }
49