1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.danube.webdav.xml.dav;
14
15 import org.abstracthorizon.danube.webdav.util.NamespacesProvider;
16 import org.abstracthorizon.danube.webdav.xml.XMLParserHandler;
17 import org.abstracthorizon.danube.webdav.xml.XMLRenderer;
18 import org.abstracthorizon.danube.webdav.xml.common.XMLUtils;
19 import org.abstracthorizon.danube.webdav.xml.dav.request.AbstractSimpleXMLHandler;
20
21 import java.io.PrintWriter;
22
23 import org.xml.sax.SAXException;
24
25
26
27
28
29
30 public class HRef extends AbstractSimpleXMLHandler implements XMLRenderer {
31
32
33 public static final String TAG_NAME = "href";
34
35
36 protected String path;
37
38
39
40
41
42 public HRef(XMLParserHandler parent) {
43 super(parent);
44 }
45
46
47
48
49
50 public HRef(String uri) {
51 super(null);
52 this.path = uri.replace(" ", "%20");
53 }
54
55
56
57
58
59
60
61
62
63 public Object end(Object current, String tag, String value) throws SAXException {
64 path = value;
65 return super.end(current, tag, value);
66 }
67
68
69
70
71
72 public String toString() {
73 return "HRef[" + path + "]";
74 }
75
76
77
78
79
80
81 public void render(PrintWriter writer, NamespacesProvider provider) {
82 writer.println(XMLUtils.createTag(provider, DAVNamespace.DAV_NAMESPACE_URL, TAG_NAME, path));
83 }
84 }