Package lumis.service.websitefiles
Class WebsiteFilesResource
- java.lang.Object
-
- lumis.service.websitefiles.WebsiteFilesResource
-
@Path("/lumis/service/websitefiles/editor") public class WebsiteFilesResource extends java.lang.Object
Resource used by website files editor to manage website files.- Since:
- 11.0.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description WebsiteFilesResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createNewDirectory(java.lang.String websiteFilesId, java.lang.String filePath, java.lang.String dirName)
Creates a new dirctory in website.void
createNewFile(java.lang.String websiteFilesId, java.lang.String filePath, java.lang.String fileName)
Creates a new text file in the given website.void
deleteFile(java.lang.String websiteFilesId, java.lang.String filePath)
Deletes a file in a webistejavax.ws.rs.core.Response
downloadZip(java.lang.String websiteFilesId, java.lang.String folderPath)
Download a zipped version of a given directory in the website.javax.ws.rs.core.Response
getFile(java.lang.String websiteFilesId, java.lang.String filePath)
Returns the content of a requested file.java.lang.String
getFolderChildren(java.lang.String websiteFilesId, java.lang.String folderPath)
returns the children files and folders given a website and root path.protected IFile
getWebsiteFilesDir(java.lang.String websiteFilesId)
Returns a file object that represents website files root folder.void
renameFile(java.lang.String websiteFilesId, java.lang.String filePath, java.lang.String newFileName)
Renames a file in the websitevoid
saveFileText(java.lang.String websiteFilesId, java.lang.String filePath, java.lang.String fileContent)
Saves file text to the given website.java.lang.String
uploadFile(java.io.InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, java.lang.String websiteFilesId, java.lang.String filePath)
Uploads a file to the given directory.java.lang.String
uploadZip(java.io.InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, java.lang.String websiteFilesId, java.lang.String filePath)
Uploads a zip file to the destination website.
-
-
-
Method Detail
-
getFolderChildren
@Path("/getfolderchildren") @GET @Produces("text/plain") public java.lang.String getFolderChildren(@QueryParam("websiteFilesId") java.lang.String websiteFilesId, @QueryParam("folderPath") java.lang.String folderPath) throws PortalException, java.io.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
java.io.IOException
- Since:
- 11.0.0
-
getFile
@Path("/getfile") @GET public javax.ws.rs.core.Response getFile(@QueryParam("websiteFilesId") java.lang.String websiteFilesId, @QueryParam("filePath") java.lang.String filePath) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
saveFileText
@Path("/savefiletext") @POST public void saveFileText(@FormParam("websiteFilesId") java.lang.String websiteFilesId, @FormParam("filePath") java.lang.String filePath, @FormParam("fileContent") java.lang.String fileContent) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
createNewFile
@Path("/createnewfile") @POST public void createNewFile(@FormParam("websiteFilesId") java.lang.String websiteFilesId, @FormParam("filePath") java.lang.String filePath, @FormParam("fileName") java.lang.String fileName) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
createNewDirectory
@Path("/createnewdir") @POST public void createNewDirectory(@FormParam("websiteFilesId") java.lang.String websiteFilesId, @FormParam("filePath") java.lang.String filePath, @FormParam("dirName") java.lang.String dirName) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
renameFile
@Path("/renamefile") @POST public void renameFile(@FormParam("websiteFilesId") java.lang.String websiteFilesId, @FormParam("filePath") java.lang.String filePath, @FormParam("newFileName") java.lang.String newFileName) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
deleteFile
@Path("/deletefile") @POST public void deleteFile(@FormParam("websiteFilesId") java.lang.String websiteFilesId, @FormParam("filePath") java.lang.String filePath) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
uploadFile
@POST @Path("/uploadfile") @Consumes("multipart/form-data") public java.lang.String uploadFile(java.io.InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, java.lang.String websiteFilesId, java.lang.String filePath) throws PortalException, java.io.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
java.io.IOException
- Since:
- 11.0.0
-
uploadZip
@POST @Path("/uploadzip") @Consumes("multipart/form-data") public java.lang.String uploadZip(java.io.InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetail, java.lang.String websiteFilesId, java.lang.String filePath) throws PortalException, java.io.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
java.io.IOException
- Since:
- 11.0.0
-
downloadZip
@Path("/downloadzip") @GET @Produces("application/octet-stream") public javax.ws.rs.core.Response downloadZip(@QueryParam("websiteFilesId") java.lang.String websiteFilesId, @QueryParam("folderPath") java.lang.String folderPath) throws java.io.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:
java.io.IOException
PortalException
- Since:
- 11.0.0
-
getWebsiteFilesDir
protected IFile getWebsiteFilesDir(java.lang.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
-
-