Class MethodBase

java.lang.Object
org.bedework.webdav.servlet.common.MethodBase
All Implemented Interfaces:
org.bedework.util.logging.Logged, SecureXml
Direct Known Subclasses:
AclMethod, CopyMethod, DeleteMethod, GetMethod, LockMethod, OptionsMethod, PostMethod, PropFindMethod, PropPatchMethod, PutMethod, ReportMethod, UnlockMethod

public abstract class MethodBase extends Object implements org.bedework.util.logging.Logged, SecureXml
Base class for all webdav servlet methods.
  • Field Details

    • dumpContent

      protected boolean dumpContent
    • hasBriefHeader

      protected boolean hasBriefHeader
    • nsIntf

      protected WebdavNsIntf nsIntf
      namespace interface for this request
    • xml

      protected org.bedework.util.xml.XmlEmit xml
  • Constructor Details

    • MethodBase

      public MethodBase()
  • Method Details

    • init

      public abstract void init()
      Called at each request
    • doMethod

      public abstract void doMethod(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      Parameters:
      req - http request
      resp - http response
    • init

      public void init(WebdavNsIntf nsIntf, boolean dumpContent)
      Called at each request
      Parameters:
      nsIntf - interface
      dumpContent - true to provide debug content dump
    • getNsIntf

      public WebdavNsIntf getNsIntf()
      Get namespace interface
      Returns:
      WebdavNsIntf
    • getResourceUri

      public String getResourceUri(javax.servlet.http.HttpServletRequest req)
      Get the decoded and fixed resource URI
      Parameters:
      req - Servlet request object
      Returns:
      String fixed up uri
    • defaultDepth

      protected int defaultDepth(int depth, int def)
    • checkDepth

      protected void checkDepth(int depth, int val)
    • getStatus

      protected String getStatus(int status, String message)
    • addStatus

      protected void addStatus(int status, String message)
    • addHeaders

      protected void addHeaders(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node)
    • checkServerInfo

      public void checkServerInfo(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
    • addDavHeader

      protected void addDavHeader(javax.servlet.http.HttpServletResponse resp, WebdavNsNode node)
    • parseContent

      protected Document parseContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      Parse the Webdav request body, and return the DOM representation.
      Parameters:
      req - Servlet request object
      resp - Servlet response object for bad status
      Returns:
      Document Parsed body or null for no body
      Throws:
      WebdavException - Some error occurred.
    • parseContent

      protected Document parseContent(int contentLength, Reader reader)
      Parse a reader and return the DOM representation.
      Parameters:
      contentLength - Content length
      reader - Reader
      Returns:
      Document Parsed body or null for no body
    • doPropFind

      public void doPropFind(WebdavNsNode node, Collection<WebdavProperty> props)
      Build the response for a single node for a propfind request
      Parameters:
      node - webdav node
      props - list of properties
    • getChildren

      protected Collection<Element> getChildren(Node nd)
    • getChildrenArray

      protected Element[] getChildrenArray(Node nd)
    • getOnlyChild

      protected org.bedework.util.misc.response.GetEntityResponse<Element> getOnlyChild(Node nd)
    • getElementContent

      protected String getElementContent(Element el)
    • isEmpty

      protected boolean isEmpty(Element el)
    • startEmit

      protected void startEmit(javax.servlet.http.HttpServletResponse resp)
    • addNs

      public void addNs(String val)
      Add a namespace
      Parameters:
      val - String namespace
      Throws:
      RuntimeException - on fatal error
    • getNsAbbrev

      public String getNsAbbrev(String ns)
      Get a namespace abbreviation
      Parameters:
      ns - namespace
      Returns:
      String abbrev
    • openTag

      protected void openTag(QName tag)
    • openTagNoNewline

      protected void openTagNoNewline(QName tag)
    • closeTag

      protected void closeTag(QName tag)
    • emptyTag

      public void emptyTag(QName tag)
      Emit an empty tag
      Parameters:
      tag - qname
      Throws:
      RuntimeException - on fatal error
    • emptyTag

      public void emptyTag(Node nd)
      Emit an empty tag corresponding to a node
      Parameters:
      nd - xml node
      Throws:
      RuntimeException - on fatal error
    • property

      public void property(QName tag, String val)
      Emit a property
      Parameters:
      tag - qname
      val - element value
      Throws:
      RuntimeException - on fatal error
    • cdataProperty

      public void cdataProperty(QName tag, String attrName, String attrVal, String val)
      Emit a property in a cdata
      Parameters:
      tag - qname
      val - element value
      Throws:
      RuntimeException - on fatal error
    • property

      public void property(QName tag, Reader val)
      Emit a property
      Parameters:
      tag - qname
      val - element value
      Throws:
      RuntimeException - on fatal error
    • propertyTagVal

      public void propertyTagVal(QName tag, QName tagVal)
      Emit a property with a qname value
      Parameters:
      tag - qname
      tagVal - qname
      Throws:
      RuntimeException - on fatal error
    • flush

      protected void flush()
    • getLogger

      public org.bedework.util.logging.BwLogger getLogger()
      Specified by:
      getLogger in interface org.bedework.util.logging.Logged