Package lumis.service.websitefiles
Class WebsiteFilesResource
- java.lang.Object
-
- lumis.service.websitefiles.WebsiteFilesResource
-
-
Constructor Summary
Constructors Constructor Description WebsiteFilesResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createNewDirectory(String websiteFilesId, String filePath, String dirName)
Creates a new dirctory in website.void
createNewFile(String websiteFilesId, String filePath, String fileName)
Creates a new text file in the given website.void
deleteFile(String websiteFilesId, String filePath)
Deletes a file in a webisteResponse
downloadZip(String websiteFilesId, String folderPath)
Download a zipped version of a given directory in the website.Response
getFile(String websiteFilesId, String filePath)
Returns the content of a requested file.String
getFolderChildren(String websiteFilesId, String folderPath)
returns the children files and folders given a website and root path.protected IFile
getWebsiteFilesDir(String websiteFilesId)
Returns a file object that represents website files root folder.void
renameFile(String websiteFilesId, String filePath, String newFileName)
Renames a file in the websitevoid
saveFileText(String websiteFilesId, String filePath, String fileContent)
Saves file text to the given website.String
uploadFile(InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, String websiteFilesId, String filePath)
Uploads a file to the given directory.String
uploadZip(InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, String websiteFilesId, String filePath)
Uploads a zip file to the destination website.
-
-
-
Method Detail
-
getFolderChildren
@Path("/getfolderchildren") @GET @Produces("text/plain") public String getFolderChildren(@QueryParam("websiteFilesId") String websiteFilesId, @QueryParam("folderPath") String folderPath) throws PortalException, IOException
returns the children files and folders given a website and root path.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.folderPath
- the root folder path.- Returns:
- the immediate children of the given folder path.
- Throws:
PortalException
IOException
- Since:
- 11.0.0
-
getFile
@Path("/getfile") @GET public Response getFile(@QueryParam("websiteFilesId") String websiteFilesId, @QueryParam("filePath") String filePath) throws IOException, PortalException
Returns the content of a requested file.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to the requested file in the website.- Returns:
- the file content
- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
saveFileText
@Path("/savefiletext") @POST public void saveFileText(@FormParam("websiteFilesId") String websiteFilesId, @FormParam("filePath") String filePath, @FormParam("fileContent") String fileContent) throws IOException, PortalException
Saves file text to the given website.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to a file in the website.fileContent
- content to be saved to the file.- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
createNewFile
@Path("/createnewfile") @POST public void createNewFile(@FormParam("websiteFilesId") String websiteFilesId, @FormParam("filePath") String filePath, @FormParam("fileName") String fileName) throws IOException, PortalException
Creates a new text file in the given website.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to a folder in the website.fileName
- the name of the new text file.- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
createNewDirectory
@Path("/createnewdir") @POST public void createNewDirectory(@FormParam("websiteFilesId") String websiteFilesId, @FormParam("filePath") String filePath, @FormParam("dirName") String dirName) throws IOException, PortalException
Creates a new dirctory in website.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to the parent folder in the website.dirName
- the name of the new directory.- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
renameFile
@Path("/renamefile") @POST public void renameFile(@FormParam("websiteFilesId") String websiteFilesId, @FormParam("filePath") String filePath, @FormParam("newFileName") String newFileName) throws IOException, PortalException
Renames a file in the website- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to a file in the website.newFileName
- the new name of the file.- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
deleteFile
@Path("/deletefile") @POST public void deleteFile(@FormParam("websiteFilesId") String websiteFilesId, @FormParam("filePath") String filePath) throws IOException, PortalException
Deletes a file in a webiste- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to a file in the website to be deleted.- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
uploadFile
@POST @Path("/uploadfile") @Consumes("multipart/form-data") public String uploadFile(InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, String websiteFilesId, String filePath) throws PortalException, IOException
Uploads a file to the given directory.- Parameters:
uploadedInputStream
- the file being uploadedfileDetail
- information of the file being uploadedwebsiteFilesId
- the identifier of the WebsiteFilesFolder.filePath
- the path to the file in the website.- Returns:
- Throws:
PortalException
IOException
- Since:
- 11.0.0
-
uploadZip
@POST @Path("/uploadzip") @Consumes("multipart/form-data") public String uploadZip(InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, String websiteFilesId, String filePath) throws PortalException, IOException
Uploads a zip file to the destination website. The zip will be unzipped to the provided directory in the website.- Parameters:
uploadedInputStream
- the zip file contentsfileDetail
- information about the zip filewebsiteFilesId
- the identifier of the websitefilePath
- the destination root directory where the zip file should be unzipped.- Returns:
- Throws:
PortalException
IOException
- Since:
- 11.0.0
-
downloadZip
@Path("/downloadzip") @GET @Produces("application/octet-stream") public Response downloadZip(@QueryParam("websiteFilesId") String websiteFilesId, @QueryParam("folderPath") String folderPath) throws IOException, PortalException
Download a zipped version of a given directory in the website.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.folderPath
- the folder to be zipped.- Returns:
- the zipped file
- Throws:
IOException
PortalException
- Since:
- 11.0.0
-
getWebsiteFilesDir
protected IFile getWebsiteFilesDir(String websiteFilesId) throws PortalException, UnexpectedException
Returns a file object that represents website files root folder.- Parameters:
websiteFilesId
- the identifier of the WebsiteFilesFolder.- Returns:
- Throws:
PortalException
UnexpectedException
- Since:
- 11.0.0
-
-