KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > webdav > lib > properties > HrefValuedProperty


1 /*
2  * $Header: /home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/properties/HrefValuedProperty.java,v 1.1.2.1 2004/09/26 14:19:20 luetzkendorf Exp $
3  * $Revision: 1.1.2.1 $
4  * $Date: 2004/09/26 14:19:20 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.webdav.lib.properties;
25
26 import org.apache.webdav.lib.BaseProperty;
27 import org.apache.webdav.lib.ResponseEntity;
28 import org.apache.webdav.lib.util.DOMUtils;
29 import org.w3c.dom.Element JavaDoc;
30
31 /**
32  * Base classe for properties with a single <code>href</code> value.
33  */

34 public class HrefValuedProperty extends BaseProperty {
35
36
37     // -------------------------------------------------------------- Constants
38

39     // ----------------------------------------------------------- Constructors
40

41     /**
42      * Default constructor for the property.
43      */

44     public HrefValuedProperty(ResponseEntity response, Element JavaDoc element) {
45         super(response, element);
46     }
47
48
49     // --------------------------------------------------------- Public Methods
50

51     /**
52      * Returns the value of the href element.
53      */

54     public String JavaDoc getHref() {
55         String JavaDoc hrefValue="";
56         Element JavaDoc href = DOMUtils.getFirstElement(element, "DAV:", "href");
57         if (href!=null)
58         {
59             hrefValue = DOMUtils.getTextValue(href);
60         }
61         return hrefValue;
62     }
63
64     public String JavaDoc getPropertyAsString() {
65         return getHref();
66     }
67
68     public String JavaDoc toString() {
69         return getHref();
70     }
71
72 }
73
Popular Tags