Package com.jalios.jcms.webdav.file
Class FileWebdavResource
- java.lang.Object
-
- com.jalios.jcms.webdav.WebdavResource
-
- com.jalios.jcms.webdav.file.FileWebdavResource
-
- All Implemented Interfaces:
java.lang.Comparable<WebdavResource>
public class FileWebdavResource extends WebdavResource
A File Representation of a resource in the Webdav FileSystem- Since:
- jcms-5.5.0
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description java.io.FileresourceFile-
Fields inherited from class com.jalios.jcms.webdav.WebdavResource
possibleFile, uri
-
-
Constructor Summary
Constructors Constructor Description FileWebdavResource(java.lang.String uri, WebdavContext ctxt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<WebdavResource>getChildren(WebdavContext ctxt)Return all the Children of the resource.longgetContentLength(WebdavContext ctxt)Return the size of the resource or 0 if there is no contentjava.lang.StringgetContentType(WebdavContext ctxt)This method have to return the Content Type of the resource with the Content Encoding ie "text/html; charset=UTF-8" It is the media type defined in section 3.7 of [RFC2068] If no content type then return ""longgetCreationDate(WebdavContext ctxt)Return long representing the Creation of the resource It contains a timestamp of the moment when the resource was created (i.e., the moment it had non-null state).longgetLastModified(WebdavContext ctxt)Return long representing the LastModified of the resource Note that the last-modified date on a resource may reflect changes in any part of the state of the resource, not necessarily just a change to the response to the GET method.java.io.InputStreamgetResourceStream(WebdavContext ctxt)This method have to return an InputStream on the resource.booleanisExisting(WebdavContext ctxt)Check if the resource exists in the UserFileSystem This method is abstract and must be implemented by the UserFileSystem.booleanisFile(WebdavContext ctxt)This method will check if the resource is a File or a Folder.booleanisFolder(WebdavContext ctxt)This method will check if the resource is a File or a Folder.booleanisHidden(WebdavContext ctxt)This method will return true if the resource isHidden.booleansetResourceStream(java.io.InputStream in, WebdavContext ctxt)This method have to return an InputStream on the resource.-
Methods inherited from class com.jalios.jcms.webdav.WebdavResource
checkUnlockAccess, compareTo, equals, getContentLanguage, getDescendantLocks, getETag, getLastAccessed, getLocks, getName, getParent, getPath, hasExclusiveLockAccess, hasLockAccess, isPossibleFile, isReadable, isWritable, putLock, putLocks, setPath, setPossibleContent, toString
-
-
-
-
Constructor Detail
-
FileWebdavResource
public FileWebdavResource(java.lang.String uri, WebdavContext ctxt)
-
-
Method Detail
-
getChildren
public java.util.Collection<WebdavResource> getChildren(WebdavContext ctxt)
Description copied from class:WebdavResourceReturn all the Children of the resource. This method is abstract and must be implemented by the UserFileSystem.- Specified by:
getChildrenin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- Collection a Collection of WebdavResource
- See Also:
WebdavResource.getChildren(WebdavContext)
-
isExisting
public boolean isExisting(WebdavContext ctxt)
Description copied from class:WebdavResourceCheck if the resource exists in the UserFileSystem This method is abstract and must be implemented by the UserFileSystem.- Specified by:
isExistingin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- true if the resource exists
- See Also:
WebdavResource.isExisting(WebdavContext)
-
isFile
public boolean isFile(WebdavContext ctxt)
Description copied from class:WebdavResourceThis method will check if the resource is a File or a Folder. Default implementation assume a File is a Collection without children.- Overrides:
isFilein classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- true if the resource is a File (ie Collection without children)
- See Also:
WebdavResource.isFile(WebdavContext)
-
isFolder
public boolean isFolder(WebdavContext ctxt)
Description copied from class:WebdavResourceThis method will check if the resource is a File or a Folder. Default implementation return !isFile()- Overrides:
isFolderin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- true if the resource is a Folder (ie Collection)
- See Also:
WebdavResource.isFolder(WebdavContext)
-
isHidden
public boolean isHidden(WebdavContext ctxt)
Description copied from class:WebdavResourceThis method will return true if the resource isHidden. Default implementation always return false to ignore this behavior. Warning! Hidden doesn't mean not readable but only hide from default user interface.- Overrides:
isHiddenin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- true if the resource is hidden
- See Also:
WebdavResource.isHidden(WebdavContext)
-
getContentLength
public long getContentLength(WebdavContext ctxt)
Description copied from class:WebdavResourceReturn the size of the resource or 0 if there is no content- Specified by:
getContentLengthin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- long the size of the file or 0 if it is a folder
- See Also:
WebdavResource.getContentLength(WebdavContext)
-
getCreationDate
public long getCreationDate(WebdavContext ctxt)
Description copied from class:WebdavResourceReturn long representing the Creation of the resource It contains a timestamp of the moment when the resource was created (i.e., the moment it had non-null state).- Specified by:
getCreationDatein classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- long the LastModified of the resource
- See Also:
WebdavResource.getCreationDate(WebdavContext)
-
getLastModified
public long getLastModified(WebdavContext ctxt)
Description copied from class:WebdavResourceReturn long representing the LastModified of the resource Note that the last-modified date on a resource may reflect changes in any part of the state of the resource, not necessarily just a change to the response to the GET method. For example, a change in a property may cause the last-modified date to change.- Specified by:
getLastModifiedin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- long the LastModified of the resource
- See Also:
WebdavResource.getLastModified(WebdavContext)
-
getContentType
public java.lang.String getContentType(WebdavContext ctxt)
Description copied from class:WebdavResourceThis method have to return the Content Type of the resource with the Content Encoding ie "text/html; charset=UTF-8" It is the media type defined in section 3.7 of [RFC2068] If no content type then return ""- Specified by:
getContentTypein classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- String a String that describe the resource ContentType or "application/octet-stream"
- See Also:
WebdavResource.getContentType(WebdavContext)
-
getResourceStream
public java.io.InputStream getResourceStream(WebdavContext ctxt) throws java.io.IOException
Description copied from class:WebdavResourceThis method have to return an InputStream on the resource. The Stream will be Buffered and Closed by the caller.- Specified by:
getResourceStreamin classWebdavResource- Parameters:
ctxt- the Webdav Context- Returns:
- InputStream an open stream to the resource
- Throws:
java.io.IOException- See Also:
WebdavResource.getResourceStream(WebdavContext)
-
setResourceStream
public boolean setResourceStream(java.io.InputStream in, WebdavContext ctxt) throws java.io.IOExceptionDescription copied from class:WebdavResourceThis method have to return an InputStream on the resource. The Stream will be Buffered and Closed by the caller. But this method may close the Stream.- Specified by:
setResourceStreamin classWebdavResource- Parameters:
in- the Request InputStreamctxt- the Webdav Context- Returns:
- boolean if the set has been correctly done
- Throws:
java.io.IOException- See Also:
WebdavResource.setResourceStream(InputStream, WebdavContext)
-
-