View Javadoc

1   /*
2    * Copyright (c) 2006-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.danube.webdav.xml.dav.response;
14  
15  import org.abstracthorizon.danube.webdav.util.NamespacesProvider;
16  import org.abstracthorizon.danube.webdav.xml.XMLRenderer;
17  import org.abstracthorizon.danube.webdav.xml.common.XMLUtils;
18  import org.abstracthorizon.danube.webdav.xml.dav.DAVNamespace;
19  
20  import java.io.PrintWriter;
21  
22  /**
23   * This class models WebDAV's responsedescription tag
24   *
25   * @author Daniel Sendula
26   */
27  public class ResponseDescription implements XMLRenderer {
28  
29      /** Tag name */
30      public static final String TAG_NAME = "responsedescription";
31  
32      /** Response descirption */
33      protected String responseDescription;
34  
35      /**
36       * Constructor
37       * @param responseDescription response description
38       */
39      public ResponseDescription(String responseDescription) {
40          this.responseDescription = responseDescription;
41      }
42  
43      /**
44       * Returns response description
45       * @return response description
46       */
47      public String getResponseDescription() {
48          return responseDescription;
49      }
50  
51      @Override
52      public String toString() {
53          return "ResponseDescription[" + responseDescription + "]";
54      }
55  
56      /**
57       * Renders the tag
58       * @param writer writer
59       * @param provider namespace provider
60       */
61      public void render(PrintWriter writer, NamespacesProvider provider) {
62          writer.println(XMLUtils.createTag(provider, DAVNamespace.DAV_NAMESPACE_URL, TAG_NAME, responseDescription));
63      }
64  }