com.opensymphony.webwork.components
Class DefaultRichtexteditorConnector
java.lang.Object
com.opensymphony.xwork.ActionSupport
com.opensymphony.webwork.components.AbstractRichtexteditorConnector
com.opensymphony.webwork.components.DefaultRichtexteditorConnector
- All Implemented Interfaces:
- ServletRequestAware, ServletResponseAware, ServletContextAware, Action, LocaleProvider, TextProvider, Validateable, ValidationAware, com.uwyn.rife.continuations.ContinuableObject, Serializable, Cloneable
public class DefaultRichtexteditorConnector
- extends AbstractRichtexteditorConnector
- implements ServletContextAware
- Version:
- $Date: 2007-03-29 14:02:59 +0800 (Thu, 29 Mar 2007) $ $Id: DefaultRichtexteditorConnector.java 2883 2007-03-29 06:02:59Z tm_jee $
- Author:
- tm_jee
- See Also:
- Serialized Form
Fields inherited from class com.opensymphony.webwork.components.AbstractRichtexteditorConnector |
_command, _currentFolder, _newFile, _newFileContentType, _newFileFileName, _newFolderName, _request, _response, _serverPath, _type, CREATE_FOLDER, FILE_UPLOAD, GET_FOLDERS, GET_FOLDERS_AND_FILES |
Method Summary |
protected String |
calculateActualServerPath(String actualServerPath,
String type,
String folderPath)
|
protected String |
calculateServerPath(String serverPath,
String folderPath,
String type)
This method should return the url that could be used to access the server-side
object. |
protected void |
copyFile(File from,
File to)
|
protected AbstractRichtexteditorConnector.CreateFolderResult |
createFolder(String virtualFolderPath,
String type,
String newFolderName)
Method that gets called when a 'CreateFolder' command is issued by the rich text
editor. |
protected long |
fileSizeInKBytes(File file)
|
protected AbstractRichtexteditorConnector.FileUploadResult |
fileUpload(String virtualFolderPath,
String type,
String filename,
String contentType,
File newFile)
Method that gets called when a 'FileUpload' command is issued by the rich text
editor. |
String |
getActualServerPath()
|
protected AbstractRichtexteditorConnector.Folder[] |
getFolders(String virtualFolderPath,
String type)
Method that gets called when a 'GetFolders' command is issued by the rich text editor. |
protected AbstractRichtexteditorConnector.FoldersAndFiles |
getFoldersAndFiles(String virtualFolderPath,
String type)
Method that gets called when a 'GetFoldersAndFiles' command is issued by the rich text
editor. |
protected boolean |
makeDirIfNotExists(String path)
|
protected boolean |
makeFileIfNotExists(String filePath)
|
void |
setActualServerPath(String actualServerPath)
|
void |
setServletContext(ServletContext servletContext)
|
protected void |
unknownCommand(String command,
String virtualFolderPath,
String type,
String filename,
String contentType,
File newFile)
Methods that get called when an unrecognized command is issued. |
Methods inherited from class com.opensymphony.webwork.components.AbstractRichtexteditorConnector |
browse, getCommand, getCurrentFolder, getNewFile, getNewFileContentType, getNewFileFileName, getNewFolderName, getServerPath, getType, setCommand, setCurrentFolder, setNewFile, setNewFileContentType, setNewFileFileName, setNewFolderName, setServerPath, setServletRequest, setServletResponse, setType, upload |
Methods inherited from class com.opensymphony.xwork.ActionSupport |
addActionError, addActionMessage, addFieldError, clearErrorsAndMessages, clone, doDefault, doInput, execute, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, pause, setActionErrors, setActionMessages, setFieldErrors, validate |
_actualServerPath
protected String _actualServerPath
DefaultRichtexteditorConnector
public DefaultRichtexteditorConnector()
getActualServerPath
public String getActualServerPath()
setActualServerPath
public void setActualServerPath(String actualServerPath)
calculateServerPath
protected String calculateServerPath(String serverPath,
String folderPath,
String type)
throws Exception
- Description copied from class:
AbstractRichtexteditorConnector
-
This method should return the url that could be used to access the server-side
object. For example, if this methods return '/aaa/bbb/ccc', the say, server-side image
selected is myImage.gif, then the image tag generated might be something like
<img src='/aaa/bbb/ccc/myImage.gif' .... /<
For example, if the folderPath is '/folder1' and the type is 'Image', the
calculated server path might be '/aaa/bbb/ccc/Image/folder1/' such that if the
image is 'myImage.gif' the src attribute of the image tag might be
'/aaa/bbb/ccc/Image/folder1/myImage.gif'.
- Specified by:
calculateServerPath
in class AbstractRichtexteditorConnector
- Parameters:
serverPath
- the server path provided through setServerPath (by default it isfolderPath
- the current folder path requestedtype
- the type (Image, Link or Flash)
- Returns:
- calculated server path
- Throws:
Exception
calculateActualServerPath
protected String calculateActualServerPath(String actualServerPath,
String type,
String folderPath)
throws Exception
- Throws:
Exception
setServletContext
public void setServletContext(ServletContext servletContext)
- Specified by:
setServletContext
in interface ServletContextAware
getFolders
protected AbstractRichtexteditorConnector.Folder[] getFolders(String virtualFolderPath,
String type)
throws Exception
- Description copied from class:
AbstractRichtexteditorConnector
-
Method that gets called when a 'GetFolders' command is issued by the rich text editor.
This method should search the server-side and return an Folder[] that the server side has.
The folder path queried by the rich text editor is
folderPath
. While the
type of could be one of 'Image', 'Link' or 'Flash'.
- Specified by:
getFolders
in class AbstractRichtexteditorConnector
- Returns:
- An array of Folders
- Throws:
Exception
getFoldersAndFiles
protected AbstractRichtexteditorConnector.FoldersAndFiles getFoldersAndFiles(String virtualFolderPath,
String type)
throws Exception
- Description copied from class:
AbstractRichtexteditorConnector
-
Method that gets called when a 'GetFoldersAndFiles' command is issued by the rich text
editor. This method should typically search the server-side for files and folders under the
provided virtualFolderPath and return a FoldersAndFiles object.
The folder path queried by the richtexted editor is
virtualFolderPath
.
While the type could be one of 'Image', 'Link' or 'Flash'.
- Specified by:
getFoldersAndFiles
in class AbstractRichtexteditorConnector
- Returns:
- FoldersAndFiles
- Throws:
Exception
createFolder
protected AbstractRichtexteditorConnector.CreateFolderResult createFolder(String virtualFolderPath,
String type,
String newFolderName)
- Description copied from class:
AbstractRichtexteditorConnector
-
Method that gets called when a 'CreateFolder' command is issued by the rich text
editor. This method would typically create a folder in the server-side if it is
allowed to do so and return the result through CreateFolderResult object. CreateFolderResult
contains static methods to return the available results.
The folder path queried by the richtexted editor is
virtualFolderPath
.
While the type could be one of 'Image', 'Link' or 'Flash'. The new folder name
to be created is newFolderName
.
- Specified by:
createFolder
in class AbstractRichtexteditorConnector
- Returns:
- CreateFolderResult
fileUpload
protected AbstractRichtexteditorConnector.FileUploadResult fileUpload(String virtualFolderPath,
String type,
String filename,
String contentType,
File newFile)
- Description copied from class:
AbstractRichtexteditorConnector
-
Method that gets called when a 'FileUpload' command is issued by the rich text
editor. This method would typically handle the file upload and return a
FileUploadResult object. FileUploadResult contains only static methods that
could create the available results.
The folder path queried by the richtexted editor is
virtualFolderPath
.
While the type could be one of 'Image', 'Link' or 'Flash'. The upload file name
is filename
while its content type is conetnType
and
its content could be read off the newFile
object.
- Specified by:
fileUpload
in class AbstractRichtexteditorConnector
- Returns:
- FileUploadResult
unknownCommand
protected void unknownCommand(String command,
String virtualFolderPath,
String type,
String filename,
String contentType,
File newFile)
- Description copied from class:
AbstractRichtexteditorConnector
-
Methods that get called when an unrecognized command is issued. Typical usage would
be to log an error message.
- Specified by:
unknownCommand
in class AbstractRichtexteditorConnector
makeDirIfNotExists
protected boolean makeDirIfNotExists(String path)
throws URISyntaxException
- Parameters:
path
-
- Returns:
- true if file already exists, false otherwise.
- Throws:
URISyntaxException
makeFileIfNotExists
protected boolean makeFileIfNotExists(String filePath)
throws IOException,
URISyntaxException
- Parameters:
filePath
-
- Returns:
- true if file already exists, false otherwise
- Throws:
IOException
URISyntaxException
copyFile
protected void copyFile(File from,
File to)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException
fileSizeInKBytes
protected long fileSizeInKBytes(File file)
throws FileNotFoundException,
IOException
- Throws:
FileNotFoundException
IOException