public abstract class WebdavNsIntf extends Object implements org.bedework.util.logging.Logged, Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
WebdavNsIntf.AclInfo
Object class passed around as we parse access.
|
static class |
WebdavNsIntf.Content |
static class |
WebdavNsIntf.PutContentResult
Result for putContent
|
protected static class |
WebdavNsIntf.SessCt |
| Modifier and Type | Field and Description |
|---|---|
protected String |
account |
protected boolean |
anonymous |
protected boolean |
dumpContent |
static int |
existanceDoesExist
We know it exists.
|
static int |
existanceMay
May exist
|
static int |
existanceMust
Must exist.
|
static int |
existanceNot
Must not exist
|
protected HashMap<String,MethodBase.MethodInfo> |
methods
Table of methods - set by servlet
|
static int |
nodeTypeCollection
Must be collection
|
static int |
nodeTypeEntity
Must be entity.
|
static int |
nodeTypePrincipal
Must be a principal.
|
static int |
nodeTypeUnknown
Unknown.
|
protected WebdavServlet |
servlet |
protected static WebdavNsIntf.SessCt |
session
Mostly to distinguish trace entries
|
protected int |
sessNum |
protected org.bedework.util.xml.XmlEmit |
xml |
| Constructor and Description |
|---|
WebdavNsIntf() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
acceptMkcolContent(javax.servlet.http.HttpServletRequest req)
Throw an exception if we don't want the content for mkcol.
|
void |
addNamespace(org.bedework.util.xml.XmlEmit xml)
Add any namespaces for xml tag names in requests and responses.
|
void |
addStatus(int status) |
abstract boolean |
canPut(WebdavNsNode node)
Return true if we can PUT this resource/entity
|
abstract void |
close()
Called on the way out to allow resources to be freed.
|
void |
closePropstat()
Close a propstat response with an ok result.
|
void |
closePropstat(int status)
Close a propstat response with given result.
|
abstract void |
copyMove(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 void |
create(WebdavNsNode node)
Create a new node.
|
abstract void |
createAlias(WebdavNsNode alias)
Creates an alias to another node.
|
abstract void |
delete(WebdavNsNode node)
Deletes a node from the namespace.
|
abstract void |
emitAcl(WebdavNsNode node) |
void |
emitError(QName errorTag,
String extra,
org.bedework.util.xml.XmlEmit xml)
Emit some failed precondition tag
|
void |
emitSupportedReportSet(WebdavNsNode node) |
static String |
fixPath(String path)
Return a path, beginning with a "/", after "." and ".." are removed.
|
protected String |
generateHtml(javax.servlet.http.HttpServletRequest req,
WebdavNsNode node)
Return a String giving an HTML representation of the directory.
|
boolean |
generatePropValue(WebdavNsNode node,
WebdavProperty pr,
boolean allProp)
Generate a response for a single webdav property.
|
abstract String |
getAcceptContentType(javax.servlet.http.HttpServletRequest req) |
abstract boolean |
getAccessControl()
Returns true if the namespace supports access control
|
abstract AccessUtil |
getAccessUtil()
Get an object suitable for use in parsing acls and generating access.
|
String |
getAccount() |
abstract Collection<String> |
getAclPrincipalInfo(WebdavNsNode node)
Return all the hrefs found in the access for th egiven node.
|
abstract String |
getAddMemberSuffix() |
boolean |
getAnonymous() |
abstract WebdavNsIntf.Content |
getBinaryContent(WebdavNsNode node)
Returns a Content object for the binary content.
|
Element[] |
getChildren(Node nd)
Get all the children if any
|
abstract Collection<WebdavNsNode> |
getChildren(WebdavNsNode node,
java.util.function.Supplier<Object> filterGetter)
Returns the immediate children of a node.
|
abstract WebdavNsIntf.Content |
getContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String contentType,
WebdavNsNode node)
Returns a Content object for the content.
|
String |
getDavHeader(WebdavNsNode node)
Return DAV header
|
abstract boolean |
getDirectoryBrowsingDisallowed()
Return true if the system disallows directory browsing.
|
String |
getElementContent(Element el) |
abstract Collection<WebdavNsNode> |
getGroups(String resourceUri,
String principalUrl)
Given a PrincipalMatchReport returns a Collection of matching nodes.
|
String |
getLocation(WebdavNsNode node)
Return the complete URL describing the location of the object
represented by the node
|
org.bedework.util.logging.BwLogger |
getLogger() |
MethodBase |
getMethod(String name)
Return the named initialised method or null if no such method or the
method requires authentication and we are anonymous
|
Collection<String> |
getMethodNames() |
abstract WebdavNsNode |
getNode(String uri,
int existence,
int nodeType,
boolean addMember)
Retrieves a node by uri, following any links.
|
Element |
getOnlyChild(Node nd)
We expect a single child
|
abstract WebdavNsNode |
getParent(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.
|
Reader |
getReader(javax.servlet.http.HttpServletRequest req) |
javax.servlet.http.HttpServletRequest |
getRequest() |
String |
getResourceUri(javax.servlet.http.HttpServletRequest req)
Get the decoded and fixed resource URI.
|
boolean |
getReturnMultistatusOk() |
ServerInfo |
getServerInfo() |
WebdavServlet |
getServlet() |
abstract String |
getSupportedLocks()
Returns the supported locks for the supportedlock property.
|
abstract WdSynchReport |
getSynchReport(String path,
String token,
int limit,
boolean recurse) |
abstract String |
getSyncToken(String path)
Used to match tokens in If header
|
String |
getUri(String href)
Return the part of the href referring to the actual entity, e.g.
|
org.bedework.util.xml.XmlEmit |
getXmlEmit() |
void |
init(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 requests
|
boolean |
knownProperty(WebdavNsNode node,
WebdavProperty pr)
Return true if a call to generatePropValue will return a value.
|
abstract void |
makeCollection(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode node)
Create an empty collection at the given location.
|
String |
makeName(String val)
Turn val into something which can be used as a name for an entity.
|
WebdavProperty |
makeProp(Element propnode)
Override this to create namespace specific property objects.
|
String |
makeServerInfoUrl(javax.servlet.http.HttpServletRequest req)
TODO - make the url value configurable
|
abstract String |
makeUserHref(String id) |
String |
normalizeUri(String uri) |
void |
openPropstat()
Open a propstat response.
|
List<WebdavProperty> |
parseProp(Node nd)
Parse a DAV:prop list of property names in any namespace.
|
boolean |
prefetch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode node)
Called before fetching in GET processing.
|
abstract WebdavNsIntf.PutContentResult |
putBinaryContent(javax.servlet.http.HttpServletRequest req,
WebdavNsNode node,
String[] contentTypePars,
InputStream contentStream,
Headers.IfHeaders ifHeaders)
Set the content from a Stream
|
abstract WebdavNsIntf.PutContentResult |
putContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode node,
String[] contentTypePars,
Reader contentRdr,
Headers.IfHeaders ifHeaders)
Set the content from a Reader
|
WebdavNsIntf.PutContentResult |
putContent(javax.servlet.http.HttpServletRequest req,
String resourceUri,
javax.servlet.http.HttpServletResponse resp,
boolean fromPost,
Headers.IfHeaders ifHeaders)
Put content for the PUT or POST methods
|
abstract void |
putNode(WebdavNsNode node)
Stores/updates an object.
|
abstract void |
rollback()
Called on the way out before close if there was an error.
|
abstract boolean |
specialUri(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String resourceUri)
Handle a special resource uri for GET.
|
void |
streamContent(InputStream in,
OutputStream out) |
boolean |
syncTokenMatch(Headers.IfHeader ih) |
abstract void |
updateAccess(WebdavNsIntf.AclInfo ainfo) |
void |
writeContent(Reader in,
Writer out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaudit, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warnprotected static volatile WebdavNsIntf.SessCt session
protected int sessNum
protected WebdavServlet servlet
protected String account
protected boolean anonymous
protected boolean dumpContent
protected org.bedework.util.xml.XmlEmit xml
protected HashMap<String,MethodBase.MethodInfo> methods
public static final int existanceNot
public static final int existanceMust
public static final int existanceDoesExist
public static final int existanceMay
public static final int nodeTypeCollection
public static final int nodeTypeEntity
public static final int nodeTypePrincipal
public static final int nodeTypeUnknown
public void init(WebdavServlet servlet, javax.servlet.http.HttpServletRequest req, HashMap<String,MethodBase.MethodInfo> methods, boolean dumpContent) throws WebdavException
servlet - req - methods - HashMap table of method infodumpContent - WebdavException - on errorpublic String getAccount()
public org.bedework.util.xml.XmlEmit getXmlEmit()
public javax.servlet.http.HttpServletRequest getRequest()
public String getDavHeader(WebdavNsNode node) throws WebdavException
node - may be null for *WebdavException - on errorpublic ServerInfo getServerInfo()
public boolean syncTokenMatch(Headers.IfHeader ih) throws WebdavException
ih - WebdavException - for invalid if headerpublic void emitError(QName errorTag, String extra, org.bedework.util.xml.XmlEmit xml) throws Throwable
errorTag - extra - xml - Throwablepublic abstract AccessUtil getAccessUtil() throws WebdavException
WebdavException - on errorpublic abstract boolean canPut(WebdavNsNode node) throws WebdavException
node - WebdavException - on errorpublic abstract String getAddMemberSuffix() throws WebdavException
WebdavException - on errorpublic Collection<String> getMethodNames()
public MethodBase getMethod(String name) throws WebdavException
name - nameWebdavException - on errorpublic boolean getAnonymous()
public String getUri(String href) throws WebdavException
href - WebdavException - on errorpublic String makeName(String val)
val - public WebdavServlet getServlet()
public boolean getReturnMultistatusOk()
public void addNamespace(org.bedework.util.xml.XmlEmit xml)
throws WebdavException
Something more like "http://ahost.rpi.edu/webdav/"
xml - WebdavException - on errorpublic abstract boolean getDirectoryBrowsingDisallowed()
throws WebdavException
WebdavException - on errorpublic abstract void rollback()
public abstract void close()
throws WebdavException
WebdavException - on errorpublic abstract String getSupportedLocks()
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>"
public abstract boolean getAccessControl()
public abstract WebdavNsNode getNode(String uri, int existence, int nodeType, boolean addMember) throws WebdavException
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 addMemberWebdavException - on errorpublic abstract void putNode(WebdavNsNode node) throws WebdavException
node - node in questionWebdavException - on errorpublic abstract void delete(WebdavNsNode node) throws WebdavException
node - node in questionWebdavException - on errorpublic abstract Collection<WebdavNsNode> getChildren(WebdavNsNode node, java.util.function.Supplier<Object> filterGetter) throws WebdavException
node - node in questionWebdavException - on errorpublic abstract WebdavNsNode getParent(WebdavNsNode node) throws WebdavException
node - node in questionWebdavException - on errorpublic boolean prefetch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode node)
throws WebdavException
This method handles etag processing.
req - resp - node - - the nodeWebdavException - on errorpublic abstract WebdavNsIntf.Content getContent(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String contentType, WebdavNsNode node) throws WebdavException
req - resp - contentType - if non-null specifies the content we wantnode - node in questionWebdavException - on errorpublic abstract WebdavNsIntf.Content getBinaryContent(WebdavNsNode node) throws WebdavException
node - node in questionWebdavException - on errorpublic abstract String getAcceptContentType(javax.servlet.http.HttpServletRequest req) throws WebdavException
WebdavExceptionpublic WebdavNsIntf.PutContentResult putContent(javax.servlet.http.HttpServletRequest req, String resourceUri, javax.servlet.http.HttpServletResponse resp, boolean fromPost, Headers.IfHeaders ifHeaders) throws WebdavException
req - the requestresourceUri - if not null use this otherwise obtain from requestresp - the responsefromPost - POST style - createifHeaders - info from headersWebdavException - on errorpublic void writeContent(Reader in, Writer out) throws WebdavException
in - out - WebdavException - on errorpublic void streamContent(InputStream in, OutputStream out) throws WebdavException
in - out - WebdavException - on errorpublic String normalizeUri(String uri) throws WebdavException
uri - to checkWebdavException - on errorpublic 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
req - resp - For any additional headersnode - node in question.contentTypePars - null or values from content-type headercontentRdr - Reader for contentifHeaders - info from headersWebdavException - on errorpublic abstract WebdavNsIntf.PutContentResult putBinaryContent(javax.servlet.http.HttpServletRequest req, WebdavNsNode node, String[] contentTypePars, InputStream contentStream, Headers.IfHeaders ifHeaders) throws WebdavException
req - node - node in question.contentTypePars - null or values from content-type headercontentStream - Stream for contentifHeaders - info from headersWebdavException - on errorpublic abstract void create(WebdavNsNode node) throws WebdavException
node - node to create with new uri setWebdavException - on errorpublic abstract void createAlias(WebdavNsNode alias) throws WebdavException
alias - alias node that should be created with uri and
targetUri setWebdavException - on errorpublic abstract void acceptMkcolContent(javax.servlet.http.HttpServletRequest req)
throws WebdavException
req - HttpServletRequestWebdavException - on errorpublic abstract void makeCollection(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode node)
throws WebdavException
req - HttpServletRequestresp - HttpServletResponsenode - node to createWebdavException - on errorpublic abstract void copyMove(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
WebdavNsNode from,
WebdavNsNode to,
boolean copy,
boolean overwrite,
int depth)
throws WebdavException
req - HttpServletRequestresp - HttpServletResponsefrom - Sourceto - Destinationcopy - true for copyingoverwrite - true to overwrite destinationdepth - 0 for entity, infinity for collection.WebdavException - on errorpublic abstract boolean specialUri(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String resourceUri)
throws WebdavException
req - HttpServletRequestresp - HttpServletResponseresourceUri - WebdavException - on errorpublic abstract WdSynchReport getSynchReport(String path, String token, int limit, boolean recurse) throws WebdavException
path - token - limit - - negative for no limit on result set sizerecurse - WebdavException - on errorpublic abstract String getSyncToken(String path) throws WebdavException
path - WebdavException - on errorpublic abstract Collection<WebdavNsNode> getGroups(String resourceUri, String principalUrl) throws WebdavException
resourceUri - - url to base search on.principalUrl - - url of principal or null for current userWebdavException - on errorpublic abstract Collection<String> getPrincipalCollectionSet(String resourceUri) throws WebdavException
resourceUri - WebdavException - on errorpublic abstract Collection<? extends WebdavNsNode> getPrincipals(String resourceUri, PrincipalPropertySearch pps) throws WebdavException
resourceUri - pps - Collection of PrincipalPropertySearchWebdavException - on errorpublic abstract String makeUserHref(String id) throws WebdavException
id - WebdavException - on errorpublic String makeServerInfoUrl(javax.servlet.http.HttpServletRequest req) throws WebdavException
req - WebdavException - on errorpublic abstract void updateAccess(WebdavNsIntf.AclInfo ainfo) throws WebdavException
ainfo - WebdavException - on errorpublic abstract void emitAcl(WebdavNsNode node) throws WebdavException
node - WebdavException - on errorpublic abstract Collection<String> getAclPrincipalInfo(WebdavNsNode node) throws WebdavException
node - WebdavException - on errorpublic void emitSupportedReportSet(WebdavNsNode node) throws WebdavException
node - WebdavException - on errorpublic void openPropstat()
throws WebdavException
WebdavException - on errorpublic void closePropstat(int status)
throws WebdavException
status - WebdavException - on errorpublic void closePropstat()
throws WebdavException
WebdavException - on errorpublic List<WebdavProperty> parseProp(Node nd) throws WebdavException
nd - the props nodeWebdavException - on errorpublic WebdavProperty makeProp(Element propnode) throws WebdavException
propnode - WebdavException - on errorpublic boolean knownProperty(WebdavNsNode node, WebdavProperty pr)
node - pr - public boolean generatePropValue(WebdavNsNode node, WebdavProperty pr, boolean allProp) throws WebdavException
node - pr - allProp - true if we're doing allpropWebdavException - on errorpublic String getLocation(WebdavNsNode node) throws WebdavException
node - node in questionWebdavException - on errorpublic void addStatus(int status)
throws WebdavException
status - WebdavException - on errorpublic String getResourceUri(javax.servlet.http.HttpServletRequest req) throws WebdavException
req - Servlet request objectWebdavException - on errorpublic static String fixPath(String path) throws WebdavException
path - String path to be fixedWebdavException - on errorpublic Reader getReader(javax.servlet.http.HttpServletRequest req) throws Throwable
req - Throwablepublic Element[] getChildren(Node nd) throws WebdavException
nd - WebdavException - on errorpublic Element getOnlyChild(Node nd) throws WebdavException
nd - WebdavException - on errorpublic String getElementContent(Element el) throws WebdavException
el - WebdavException - on errorprotected String generateHtml(javax.servlet.http.HttpServletRequest req, WebdavNsNode node) throws WebdavException
Use 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.
req - node - WebdavNsNodeWebdavException - on errorpublic org.bedework.util.logging.BwLogger getLogger()
getLogger in interface org.bedework.util.logging.LoggedCopyright © 2018 Bedework. All rights reserved.