Class WebDavServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v2.service.webdav.WebDavServiceImpl
-
- All Implemented Interfaces:
WebDavService
public class WebDavServiceImpl extends Object implements WebDavService
Default implementation ofWebDavService
.- Since:
- 3.1.4
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected Charset
charset
Charset used to encode paths in URLs.static String
FILTER_ALL_ITEMS
protected SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.webdav.WebDavProfile>
profileLoader
Instance ofSiteAwareConfigProfileLoader
used to load the configuration file.protected SiteService
siteService
Instance ofSiteService
protected String
urlPattern
-
Constructor Summary
Constructors Constructor Description WebDavServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getName(com.github.sardine.DavResource resource)
protected org.craftercms.commons.config.profiles.webdav.WebDavProfile
getProfile(String site, String profileId)
protected String
getRemoteAssetUrl(String profileId, String fullPath)
protected String
getRemoteAssetUrl(String profileId, String path, String filename)
protected String
getUrl(com.github.sardine.DavResource resource, String profileId, org.craftercms.commons.config.profiles.webdav.WebDavProfile profile)
@Valid List<WebDavItem>
list(String siteId, String profileId, String path, String type)
Lists resources in the specified path.void
setProfileLoader(SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.webdav.WebDavProfile> profileLoader)
void
setSiteService(SiteService siteService)
void
setUrlPattern(String urlPattern)
@Valid WebDavItem
upload(String siteId, String profileId, String path, String filename, InputStream content)
Uploads a file in the specified path.
-
-
-
Field Detail
-
FILTER_ALL_ITEMS
public static final String FILTER_ALL_ITEMS
- See Also:
- Constant Field Values
-
urlPattern
protected String urlPattern
-
profileLoader
protected SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.webdav.WebDavProfile> profileLoader
Instance ofSiteAwareConfigProfileLoader
used to load the configuration file.
-
charset
protected Charset charset
Charset used to encode paths in URLs.
-
siteService
protected SiteService siteService
Instance ofSiteService
-
-
Method Detail
-
getProfile
protected org.craftercms.commons.config.profiles.webdav.WebDavProfile getProfile(String site, String profileId) throws WebDavException, org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
- Throws:
WebDavException
org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
-
list
@Valid public @Valid List<WebDavItem> list(String siteId, String profileId, String path, String type) throws WebDavException, SiteNotFoundException, org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
Lists resources in the specified path.- Specified by:
list
in interfaceWebDavService
- Parameters:
siteId
- the id of the siteprofileId
- the id of the profilepath
- the relative path to listtype
- mime type used for filtering- Returns:
- list of resources found
- Throws:
WebDavException
- if there is an error connecting to the server or listing the resourcesSiteNotFoundException
- if the site is not foundorg.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
- if the profile is not found
-
getUrl
protected String getUrl(com.github.sardine.DavResource resource, String profileId, org.craftercms.commons.config.profiles.webdav.WebDavProfile profile)
-
getRemoteAssetUrl
protected String getRemoteAssetUrl(String profileId, String path, String filename)
-
getName
protected String getName(com.github.sardine.DavResource resource)
-
upload
@Valid public @Valid WebDavItem upload(String siteId, String profileId, String path, String filename, InputStream content) throws WebDavException, SiteNotFoundException, org.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
Uploads a file in the specified path.- Specified by:
upload
in interfaceWebDavService
- Parameters:
siteId
- the id of the siteprofileId
- the id of the profilepath
- the relative path to upload the filefilename
- the name of the file to uploadcontent
- stream providing the content of the file- Returns:
- the uploaded item
- Throws:
WebDavException
- if there is an error connecting to the server or uploading the fileSiteNotFoundException
- if the site is not foundorg.craftercms.commons.config.profiles.ConfigurationProfileNotFoundException
- if the profile is not found
-
setUrlPattern
public void setUrlPattern(String urlPattern)
-
setProfileLoader
public void setProfileLoader(SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.webdav.WebDavProfile> profileLoader)
-
setSiteService
public void setSiteService(SiteService siteService)
-
-