Class WebdavNsIntf
- java.lang.Object
-
- org.bedework.webdav.servlet.shared.WebdavNsIntf
-
- All Implemented Interfaces:
Serializable,org.bedework.util.logging.Logged
public abstract class WebdavNsIntf extends Object implements org.bedework.util.logging.Logged, Serializable
This acts as an interface to the underlying namespace for which this servlet is acting as a gateway. This could be a file system, a set of dynamically created objects or some sort of CMS for example. A namespace consists of a number of nodes which may be containers for other nodes or leaf nodes. All nodes are considered identical in their capabilities, that is, a non-terminal node might contain content. Some nodes are aliases of other nodes (e.g. symlinks in a unix file system). By default these aliases will be followed.- Author:
- Mike Douglass
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWebdavNsIntf.AclInfoObject class passed around as we parse access.static classWebdavNsIntf.Contentstatic classWebdavNsIntf.PutContentResultResult for putContentprotected static classWebdavNsIntf.SessCt
-
Field Summary
Fields Modifier and Type Field Description protected Stringaccountprotected booleananonymousprotected booleandumpContentstatic intexistanceDoesExistWe know it exists.static intexistanceMayMay existstatic intexistanceMustMust exist.static intexistanceNotMust not existprotected HashMap<String,MethodBase.MethodInfo>methodsTable of methods - set by servletstatic intnodeTypeCollectionMust be collectionstatic intnodeTypeEntityMust be entity.static intnodeTypePrincipalMust be a principal.static intnodeTypeUnknownUnknown.protected WebdavServletservletprotected static WebdavNsIntf.SessCtsessionMostly to distinguish trace entriesprotected intsessNumprotected org.bedework.util.xml.XmlEmitxml
-
Constructor Summary
Constructors Constructor Description WebdavNsIntf()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidacceptMkcolContent(javax.servlet.http.HttpServletRequest req)Throw an exception if we don't want the content for mkcol.voidaddNamespace(org.bedework.util.xml.XmlEmit xml)Add any namespaces for xml tag names in requests and responses.voidaddStatus(int status)abstract booleancanPut(WebdavNsNode node)Return true if we can PUT this resource/entityabstract voidclose()Called on the way out to allow resources to be freed.voidclosePropstat()Close a propstat response with an ok result.voidclosePropstat(int status)Close a propstat response with given result.abstract voidcopyMove(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode from, WebdavNsNode to, boolean copy, boolean overwrite, int depth)Copy or move a resource at the given location to another location.abstract voidcreate(WebdavNsNode node)Create a new node.abstract voidcreateAlias(WebdavNsNode alias)Creates an alias to another node.abstract voiddelete(WebdavNsNode node)Deletes a node from the namespace.abstract voidemitAcl(WebdavNsNode node)voidemitError(QName errorTag, String extra, org.bedework.util.xml.XmlEmit xml)Emit some failed precondition tagvoidemitSupportedReportSet(WebdavNsNode node)static StringfixPath(String path)Return a path, beginning with a "/", after "." and ".." are removed.protected StringgenerateHtml(javax.servlet.http.HttpServletRequest req, WebdavNsNode node)Return a String giving an HTML representation of the directory.booleangeneratePropValue(WebdavNsNode node, WebdavProperty pr, boolean allProp)Generate a response for a single webdav property.abstract StringgetAcceptContentType(javax.servlet.http.HttpServletRequest req)abstract booleangetAccessControl()Returns true if the namespace supports access controlabstract AccessUtilgetAccessUtil()Get an object suitable for use in parsing acls and generating access.StringgetAccount()abstract Collection<String>getAclPrincipalInfo(WebdavNsNode node)Return all the hrefs found in the access for th egiven node.abstract StringgetAddMemberSuffix()booleangetAnonymous()abstract WebdavNsIntf.ContentgetBinaryContent(WebdavNsNode node)Returns a Content object for the binary content.abstract Collection<WebdavNsNode>getChildren(WebdavNsNode node, Supplier<Object> filterGetter)Returns the immediate children of a node.Element[]getChildren(Node nd)Get all the children if anyabstract WebdavNsIntf.ContentgetContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String contentType, WebdavNsNode node)Returns a Content object for the content.StringgetDavHeader(WebdavNsNode node)Return DAV headerabstract booleangetDirectoryBrowsingDisallowed()Return true if the system disallows directory browsing.StringgetElementContent(Element el)abstract Collection<WebdavNsNode>getGroups(String resourceUri, String principalUrl)Given a PrincipalMatchReport returns a Collection of matching nodes.StringgetLocation(WebdavNsNode node)Return the complete URL describing the location of the object represented by the nodeorg.bedework.util.logging.BwLoggergetLogger()MethodBasegetMethod(String name)Return the named initialised method or null if no such method or the method requires authentication and we are anonymousCollection<String>getMethodNames()abstract WebdavNsNodegetNode(String uri, int existence, int nodeType, boolean addMember)Retrieves a node by uri, following any links.ElementgetOnlyChild(Node nd)We expect a single childabstract WebdavNsNodegetParent(WebdavNsNode node)Returns the parent of a node.abstract Collection<String>getPrincipalCollectionSet(String resourceUri)Given a uri returns a Collection of uris that allow search operations on principals for that resource.abstract Collection<? extends WebdavNsNode>getPrincipals(String resourceUri, PrincipalPropertySearch pps)Given a PrincipalPropertySearch returns a Collection of matching nodes.ReadergetReader(javax.servlet.http.HttpServletRequest req)javax.servlet.http.HttpServletRequestgetRequest()StringgetResourceUri(javax.servlet.http.HttpServletRequest req)Get the decoded and fixed resource URI.booleangetReturnMultistatusOk()ServerInfogetServerInfo()WebdavServletgetServlet()abstract StringgetSupportedLocks()Returns the supported locks for the supportedlock property.abstract WdSynchReportgetSynchReport(String path, String token, int limit, boolean recurse)abstract StringgetSyncToken(String path)Used to match tokens in If headerabstract WdSysIntfgetSysIntf()StringgetUri(String href)Return the part of the href referring to the actual entity, e.g.org.bedework.util.xml.XmlEmitgetXmlEmit()voidinit(WebdavServlet servlet, javax.servlet.http.HttpServletRequest req, HashMap<String,MethodBase.MethodInfo> methods, boolean dumpContent)Called before any other method is called to allow initialisation to take place at the first or subsequent requestsbooleanknownProperty(WebdavNsNode node, WebdavProperty pr)Return true if a call to generatePropValue will return a value.abstract voidmakeCollection(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node)Create an empty collection at the given location.StringmakeName(String val)Turn val into something which can be used as a name for an entity.WebdavPropertymakeProp(Element propnode)Override this to create namespace specific property objects.StringmakeServerInfoUrl(javax.servlet.http.HttpServletRequest req)TODO - make the url value configurableabstract StringmakeUserHref(String id)StringnormalizeUri(String uri)voidopenPropstat()Open a propstat response.List<WebdavProperty>parseProp(Node nd)Parse a DAV:prop list of property names in any namespace.booleanprefetch(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node)Called before fetching in GET processing.abstract WebdavNsIntf.PutContentResultputBinaryContent(javax.servlet.http.HttpServletRequest req, WebdavNsNode node, String[] contentTypePars, InputStream contentStream, Headers.IfHeaders ifHeaders)Set the content from a StreamWebdavNsIntf.PutContentResultputContent(javax.servlet.http.HttpServletRequest req, String resourceUri, javax.servlet.http.HttpServletResponse resp, boolean fromPost, Headers.IfHeaders ifHeaders)Put content for the PUT or POST methodsabstract WebdavNsIntf.PutContentResultputContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node, String[] contentTypePars, Reader contentRdr, Headers.IfHeaders ifHeaders)Set the content from a Readerabstract voidputNode(WebdavNsNode node)Stores/updates an object.abstract voidrollback()Called on the way out before close if there was an error.abstract booleanspecialUri(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String resourceUri)Handle a special resource uri for GET.voidstreamContent(InputStream in, OutputStream out)booleansyncTokenMatch(Headers.IfHeader ih)abstract voidupdateAccess(WebdavNsIntf.AclInfo ainfo)voidwriteContent(Reader in, Writer out)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warn
-
-
-
-
Field Detail
-
session
protected static final WebdavNsIntf.SessCt session
Mostly to distinguish trace entries
-
sessNum
protected int sessNum
-
servlet
protected WebdavServlet servlet
-
account
protected String account
-
anonymous
protected boolean anonymous
-
dumpContent
protected boolean dumpContent
-
xml
protected org.bedework.util.xml.XmlEmit xml
-
methods
protected HashMap<String,MethodBase.MethodInfo> methods
Table of methods - set by servlet
-
existanceNot
public static final int existanceNot
Must not exist- See Also:
- Constant Field Values
-
existanceMust
public static final int existanceMust
Must exist.- See Also:
- Constant Field Values
-
existanceDoesExist
public static final int existanceDoesExist
We know it exists.- See Also:
- Constant Field Values
-
existanceMay
public static final int existanceMay
May exist- See Also:
- Constant Field Values
-
nodeTypeCollection
public static final int nodeTypeCollection
Must be collection- See Also:
- Constant Field Values
-
nodeTypeEntity
public static final int nodeTypeEntity
Must be entity.- See Also:
- Constant Field Values
-
nodeTypePrincipal
public static final int nodeTypePrincipal
Must be a principal.- See Also:
- Constant Field Values
-
nodeTypeUnknown
public static final int nodeTypeUnknown
Unknown.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(WebdavServlet servlet, javax.servlet.http.HttpServletRequest req, HashMap<String,MethodBase.MethodInfo> methods, boolean dumpContent) throws WebdavException
Called before any other method is called to allow initialisation to take place at the first or subsequent requests- Parameters:
servlet- the WebDAV servletreq- http requestmethods- HashMap table of method infodumpContent- true to provide a debug trace of content- Throws:
WebdavException- on error
-
getAccount
public String getAccount()
- Returns:
- String
-
getXmlEmit
public org.bedework.util.xml.XmlEmit getXmlEmit()
- Returns:
- XmlEmit xmlemitter
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()
- Returns:
- HttpServletRequest
-
getDavHeader
public String getDavHeader(WebdavNsNode node) throws WebdavException
Return DAV header- Parameters:
node- may be null for *- Returns:
- String
- Throws:
WebdavException- on error
-
getServerInfo
public ServerInfo getServerInfo()
- Returns:
- server info populated for basic webdav
-
syncTokenMatch
public boolean syncTokenMatch(Headers.IfHeader ih) throws WebdavException
- Parameters:
ih-- Returns:
- false for a mismatch
- Throws:
WebdavException- for invalid if header
-
emitError
public void emitError(QName errorTag, String extra, org.bedework.util.xml.XmlEmit xml)
Emit some failed precondition tag- Parameters:
errorTag-extra-xml-
-
getSysIntf
public abstract WdSysIntf getSysIntf()
- Returns:
- system interface
-
getAccessUtil
public abstract AccessUtil getAccessUtil() throws WebdavException
Get an object suitable for use in parsing acls and generating access.- Returns:
- AccessUtil implementation.
- Throws:
WebdavException- on error
-
canPut
public abstract boolean canPut(WebdavNsNode node) throws WebdavException
Return true if we can PUT this resource/entity- Parameters:
node-- Returns:
- boolean
- Throws:
WebdavException- on error
-
getAddMemberSuffix
public abstract String getAddMemberSuffix() throws WebdavException
- Returns:
- - null if DAV:add-member not supported
- Throws:
WebdavException- on error
-
getMethodNames
public Collection<String> getMethodNames()
- Returns:
- Collection of method names.
-
getMethod
public MethodBase getMethod(String name) throws WebdavException
Return the named initialised method or null if no such method or the method requires authentication and we are anonymous- Parameters:
name- name- Returns:
- MethodBase object or null
- Throws:
WebdavException- on error
-
getAnonymous
public boolean getAnonymous()
- Returns:
- boolean true for anon access
-
getUri
public String getUri(String href) throws WebdavException
Return the part of the href referring to the actual entity, e.g.
for http://localhost/ucaldav/user/caluser/calendar/2656-uwcal-demouwcalendar@mysite.edu.ics
user/caluser/calendar/2656-uwcal-demouwcalendar@mysite.edu.ics- Parameters:
href-- Returns:
- String
- Throws:
WebdavException- on error
-
makeName
public String makeName(String val)
Turn val into something which can be used as a name for an entity. This involves removing path delimiters such as "/".- Parameters:
val-- Returns:
- modified name
-
getServlet
public WebdavServlet getServlet()
- Returns:
- WebdavServlet
-
getReturnMultistatusOk
public boolean getReturnMultistatusOk()
- Returns:
- boolean
-
addNamespace
public void addNamespace(org.bedework.util.xml.XmlEmit xml)
Add any namespaces for xml tag names in requests and responses. An abbreviation will be supplied by the servlet. The name should be globally unique in a global sense so don't return something like "RPI:"Something more like "http://ahost.rpi.edu/webdav/"
- Parameters:
xml-
-
getDirectoryBrowsingDisallowed
public abstract boolean getDirectoryBrowsingDisallowed() throws WebdavExceptionReturn true if the system disallows directory browsing.- Returns:
- boolean
- Throws:
WebdavException- on error
-
rollback
public abstract void rollback()
Called on the way out before close if there was an error.
-
close
public abstract void close() throws WebdavExceptionCalled on the way out to allow resources to be freed.- Throws:
WebdavException- on error
-
getSupportedLocks
public abstract String getSupportedLocks()
Returns the supported locks for the supportedlock property.To ensure these will work always provide the full namespace "DAV:" for example, the result for supported exclusive and shared write locks would be the string "<DAV:lockentry>" + " <DAV:lockscope><DAV:exclusive/><DAV:/lockscope>" + " <DAV:locktype><DAV:write/><DAV:/locktype>" + "<DAV:/lockentry>" + "<DAV:lockentry>" + " <DAV:lockscope><DAV:shared/><DAV:/lockscope>" + "<DAV:/lockentry>"
- Returns:
- String response
-
getAccessControl
public abstract boolean getAccessControl()
Returns true if the namespace supports access control- Returns:
- boolean
-
getNode
public abstract WebdavNsNode getNode(String uri, int existence, int nodeType, boolean addMember) throws WebdavException
Retrieves a node by uri, following any links.- Parameters:
uri- String decoded uri of the node to retrieveexistence- Say's something about the state of existencenodeType- Say's something about the type of nodeaddMember- Called from POST with addMember- Returns:
- WebdavNsNode node specified by the URI or the node aliased by the node at the URI.
- Throws:
WebdavException- on error
-
putNode
public abstract void putNode(WebdavNsNode node) throws WebdavException
Stores/updates an object.- Parameters:
node- node in question- Throws:
WebdavException- on error
-
delete
public abstract void delete(WebdavNsNode node) throws WebdavException
Deletes a node from the namespace.- Parameters:
node- node in question- Throws:
WebdavException- on error
-
getChildren
public abstract Collection<WebdavNsNode> getChildren(WebdavNsNode node, Supplier<Object> filterGetter) throws WebdavException
Returns the immediate children of a node.- Parameters:
node- node in question- Returns:
- Collection of WebdavNsNode children
- Throws:
WebdavException- on error
-
getParent
public abstract WebdavNsNode getParent(WebdavNsNode node) throws WebdavException
Returns the parent of a node.- Parameters:
node- node in question- Returns:
- WebdavNsNode node's parent, or null if the specified node is the root
- Throws:
WebdavException- on error
-
prefetch
public boolean prefetch(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node) throws WebdavExceptionCalled before fetching in GET processing. ALlows implementations to add some pre-processing, for instance the schedule-tag processing in CalDAV.This method handles etag processing.
- Parameters:
req- http requestresp- http responsenode- - the node- Returns:
- true - just proceed otherwise status is set
- Throws:
WebdavException- on error
-
getContent
public abstract WebdavNsIntf.Content getContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String contentType, WebdavNsNode node) throws WebdavException
Returns a Content object for the content.- Parameters:
req- http requestresp- http responsecontentType- if non-null specifies the content we wantnode- node in question- Returns:
- content.
- Throws:
WebdavException- on error
-
getBinaryContent
public abstract WebdavNsIntf.Content getBinaryContent(WebdavNsNode node) throws WebdavException
Returns a Content object for the binary content.- Parameters:
node- node in question- Returns:
- content.
- Throws:
WebdavException- on error
-
getAcceptContentType
public abstract String getAcceptContentType(javax.servlet.http.HttpServletRequest req) throws WebdavException
- Returns:
- a valid content type string
- Throws:
WebdavException
-
putContent
public WebdavNsIntf.PutContentResult putContent(javax.servlet.http.HttpServletRequest req, String resourceUri, javax.servlet.http.HttpServletResponse resp, boolean fromPost, Headers.IfHeaders ifHeaders) throws WebdavException
Put content for the PUT or POST methods- Parameters:
req- the requestresourceUri- if not null use this otherwise obtain from requestresp- the responsefromPost- POST style - createifHeaders- info from headers- Returns:
- PutContentResult result of creating
- Throws:
WebdavException- on error
-
writeContent
public void writeContent(Reader in, Writer out) throws WebdavException
- Parameters:
in-out-- Throws:
WebdavException- on error
-
streamContent
public void streamContent(InputStream in, OutputStream out) throws WebdavException
- Parameters:
in-out-- Throws:
WebdavException- on error
-
normalizeUri
public String normalizeUri(String uri) throws WebdavException
- Parameters:
uri- to check- Returns:
- normalized form
- Throws:
WebdavException- on error
-
putContent
public abstract WebdavNsIntf.PutContentResult putContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node, String[] contentTypePars, Reader contentRdr, Headers.IfHeaders ifHeaders) throws WebdavException
Set the content from a Reader- Parameters:
req-resp- For any additional headersnode- node in question.contentTypePars- null or values from content-type headercontentRdr- Reader for contentifHeaders- info from headers- Returns:
- PutContentResult result of creating
- Throws:
WebdavException- on error
-
putBinaryContent
public abstract WebdavNsIntf.PutContentResult putBinaryContent(javax.servlet.http.HttpServletRequest req, WebdavNsNode node, String[] contentTypePars, InputStream contentStream, Headers.IfHeaders ifHeaders) throws WebdavException
Set the content from a Stream- Parameters:
req-node- node in question.contentTypePars- null or values from content-type headercontentStream- Stream for contentifHeaders- info from headers- Returns:
- PutContentResult result of creating
- Throws:
WebdavException- on error
-
create
public abstract void create(WebdavNsNode node) throws WebdavException
Create a new node.- Parameters:
node- node to create with new uri set- Throws:
WebdavException- on error
-
createAlias
public abstract void createAlias(WebdavNsNode alias) throws WebdavException
Creates an alias to another node.- Parameters:
alias- alias node that should be created with uri and targetUri set- Throws:
WebdavException- on error
-
acceptMkcolContent
public abstract void acceptMkcolContent(javax.servlet.http.HttpServletRequest req) throws WebdavExceptionThrow an exception if we don't want the content for mkcol.- Parameters:
req- HttpServletRequest- Throws:
WebdavException- on error
-
makeCollection
public abstract void makeCollection(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode node) throws WebdavExceptionCreate an empty collection at the given location. Status is set on return- Parameters:
req- HttpServletRequestresp- HttpServletResponsenode- node to create- Throws:
WebdavException- on error
-
copyMove
public abstract void copyMove(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, WebdavNsNode from, WebdavNsNode to, boolean copy, boolean overwrite, int depth) throws WebdavExceptionCopy or move a resource at the given location to another location. Status is set on return- Parameters:
req- HttpServletRequestresp- HttpServletResponsefrom- Sourceto- Destinationcopy- true for copyingoverwrite- true to overwrite destinationdepth- 0 for entity, infinity for collection.- Throws:
WebdavException- on error
-
specialUri
public abstract boolean specialUri(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String resourceUri) throws WebdavExceptionHandle a special resource uri for GET. Status is set on return- Parameters:
req- HttpServletRequestresp- HttpServletResponseresourceUri-- Returns:
- boolean true if it was a special uri and is processed
- Throws:
WebdavException- on error
-
getSynchReport
public abstract WdSynchReport getSynchReport(String path, String token, int limit, boolean recurse) throws WebdavException
- Parameters:
path- to collectiontoken- sync-token or nulllimit- - negative for no limit on result set sizerecurse- - true for infinite depth- Returns:
- report
- Throws:
WebdavException- on error
-
getSyncToken
public abstract String getSyncToken(String path) throws WebdavException
Used to match tokens in If header- Parameters:
path- for collection- Returns:
- sync token or null
- Throws:
WebdavException- on error
-
getGroups
public abstract Collection<WebdavNsNode> getGroups(String resourceUri, String principalUrl) throws WebdavException
Given a PrincipalMatchReport returns a Collection of matching nodes.- Parameters:
resourceUri- - url to base search on.principalUrl- - url of principal or null for current user- Returns:
- Collection of WebdavNsNode
- Throws:
WebdavException- on error
-
getPrincipalCollectionSet
public abstract Collection<String> getPrincipalCollectionSet(String resourceUri) throws WebdavException
Given a uri returns a Collection of uris that allow search operations on principals for that resource.- Parameters:
resourceUri-- Returns:
- Collection of String
- Throws:
WebdavException- on error
-
getPrincipals
public abstract Collection<? extends WebdavNsNode> getPrincipals(String resourceUri, PrincipalPropertySearch pps) throws WebdavException
Given a PrincipalPropertySearch returns a Collection of matching nodes.- Parameters:
resourceUri-pps- Collection of PrincipalPropertySearch- Returns:
- Collection of WebdavNsNode
- Throws:
WebdavException- on error
-
makeUserHref
public abstract String makeUserHref(String id) throws WebdavException
- Parameters:
id-- Returns:
- String href
- Throws:
WebdavException- on error
-
makeServerInfoUrl
public String makeServerInfoUrl(javax.servlet.http.HttpServletRequest req) throws WebdavException
TODO - make the url value configurable- Parameters:
req- http request- Returns:
- Throws:
WebdavException- on error
-
updateAccess
public abstract void updateAccess(WebdavNsIntf.AclInfo ainfo) throws WebdavException
- Parameters:
ainfo-- Throws:
WebdavException- on error
-
emitAcl
public abstract void emitAcl(WebdavNsNode node) throws WebdavException
- Parameters:
node-- Throws:
WebdavException- on error
-
getAclPrincipalInfo
public abstract Collection<String> getAclPrincipalInfo(WebdavNsNode node) throws WebdavException
Return all the hrefs found in the access for th egiven node.- Parameters:
node-- Returns:
- Collection of hrefs.
- Throws:
WebdavException- on error
-
emitSupportedReportSet
public void emitSupportedReportSet(WebdavNsNode node) throws WebdavException
- Parameters:
node-- Throws:
WebdavException- on error
-
openPropstat
public void openPropstat()
Open a propstat response.
-
closePropstat
public void closePropstat(int status)
Close a propstat response with given result.- Parameters:
status- int value
-
closePropstat
public void closePropstat() throws WebdavExceptionClose a propstat response with an ok result.- Throws:
WebdavException- on error
-
parseProp
public List<WebdavProperty> parseProp(Node nd) throws WebdavException
Parse a DAV:prop list of property names in any namespace.- Parameters:
nd- the props node- Returns:
- Collection
- Throws:
WebdavException- on error
-
makeProp
public WebdavProperty makeProp(Element propnode) throws WebdavException
Override this to create namespace specific property objects.- Parameters:
propnode- node specifying proeprty- Returns:
- WebdavProperty
- Throws:
WebdavException- on error
-
knownProperty
public boolean knownProperty(WebdavNsNode node, WebdavProperty pr)
Return true if a call to generatePropValue will return a value.- Parameters:
node-pr-- Returns:
- boolean
-
generatePropValue
public boolean generatePropValue(WebdavNsNode node, WebdavProperty pr, boolean allProp) throws WebdavException
Generate a response for a single webdav property. This should be overrriden to handle other namespaces.- Parameters:
node-pr-allProp- true if we're doing allprop- Returns:
- boolean false for unknown (or unset)
- Throws:
WebdavException- on error
-
getLocation
public String getLocation(WebdavNsNode node) throws WebdavException
Return the complete URL describing the location of the object represented by the node- Parameters:
node- node in question- Returns:
- String url
- Throws:
WebdavException- on error
-
addStatus
public void addStatus(int status)
- Parameters:
status- int value
-
getResourceUri
public String getResourceUri(javax.servlet.http.HttpServletRequest req) throws WebdavException
Get the decoded and fixed resource URI. This calls getServletPath() to obtain the path information. The description of that method is a little obscure in it's meaning. In a request of this form:
"GET /ucaldav/user/douglm/calendar/1302064354993-g.ics HTTP/1.1[\r][\n]"
getServletPath() will return
/user/douglm/calendar/1302064354993-g.ics
that is the context has been removed. In addition this method will URL decode the path. getRequestUrl() does neither.- Parameters:
req- Servlet request object- Returns:
- String fixed up uri
- Throws:
WebdavException- on error
-
fixPath
public static String fixPath(String path) throws WebdavException
Return a path, beginning with a "/", after "." and ".." are removed. If the parameter path attempts to go above the root we return null. Other than the backslash thing why not use URI?- Parameters:
path- String path to be fixed- Returns:
- String fixed path
- Throws:
WebdavException- on error
-
getReader
public Reader getReader(javax.servlet.http.HttpServletRequest req) throws WebdavException
- Parameters:
req- http request- Returns:
- possibly wrapped reader
- Throws:
WebdavException- on fatal error
-
getChildren
public Element[] getChildren(Node nd) throws WebdavException
Get all the children if any- Parameters:
nd-- Returns:
- array of Element
- Throws:
WebdavException- on error
-
getOnlyChild
public Element getOnlyChild(Node nd) throws WebdavException
We expect a single child- Parameters:
nd-- Returns:
- Element
- Throws:
WebdavException- on error
-
getElementContent
public String getElementContent(Element el) throws WebdavException
- Parameters:
el-- Returns:
- String
- Throws:
WebdavException- on error
-
generateHtml
protected String generateHtml(javax.servlet.http.HttpServletRequest req, WebdavNsNode node) throws WebdavException
Return a String giving an HTML representation of the directory. TODOUse some form of template to generate an internationalized form of the listing. We don't need a great deal to start with. It will also allow us to provide stylesheets, images etc. Probably place it in the resources directory.
- Parameters:
req- http requestnode- WebdavNsNode- Returns:
- Reader
- Throws:
WebdavException- on error
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-
-