com.opensymphony.webwork.views.jsp.ui
Class AbstractRichtexteditorResult

java.lang.Object
  extended by com.opensymphony.webwork.views.jsp.ui.AbstractRichtexteditorResult
All Implemented Interfaces:
Result, Serializable
Direct Known Subclasses:
RichtexteditorCreateFolderResult, RichtexteditorFileUploadResult, RichtexteditorGetFoldersAndFilesResult, RichtexteditorGetFoldersResult

public abstract class AbstractRichtexteditorResult
extends Object
implements Result

Abstract result for all Rich Text Editor results. It contains common methods that might come in handy to its subclass. Configuration of result necessary in xwork.xml (is already there by default) are as follows:

  <!-- Results necessary when using 'browse server' and 'upload' feature of Richtexteditor -->
  <result-type name="richtexteditorGetFolders" 
                  class="com.opensymphony.webwork.views.jsp.ui.RichtexteditorGetFoldersResult" />
  <result-type name="richtexteditorGetFoldersAndFiles" 
                  class="com.opensymphony.webwork.views.jsp.ui.RichtexteditorGetFoldersAndFilesResult" />
  <result-type name="richtexteditorCreateFolder" 
                  class="com.opensymphony.webwork.views.jsp.ui.RichtexteditorCreateFolderResult" />
  <result-type name="richtexteditorFileUpload" 
                  class="com.opensymphony.webwork.views.jsp.ui.RichtexteditorFileUploadResult" />
 

Version:
$Date: 2006-03-09 04:22:35 +0800 (Thu, 09 Mar 2006) $ $Id: AbstractRichtexteditorResult.java 2338 2006-03-08 20:22:35Z rainerh $
Author:
tm_jee
See Also:
Serialized Form

Constructor Summary
AbstractRichtexteditorResult()
           
 
Method Summary
protected  Element buildCommonResponseXml(Document document, String command, String type, String folderPath, String serverPath)
          Build a common xml structure for all xml based result.
protected  Document buildDocument()
          Build an xml Document
protected  String getCommand(ActionInvocation invocation)
          Get the command send by the Rich Text Editor.
protected  String getFolderPath(ActionInvocation invocation)
          Get the folder path send by the Rich Text Editor.
protected  String getServerPath(ActionInvocation invocation)
          Get the server path calculated from AbstractRichtexteditoConnector or its decendant through AbstractRichtexteditorConnector#calculate#calculateServerPath(String, String String)
protected  String getType(ActionInvocation invocation)
          Get the type send by the Rich Text Editor.
protected  AbstractRichtexteditorConnector.CreateFolderResult richtexteditorCreateFolderResult(ActionInvocation invocation)
          Get the CreateFolderResult computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#createFolder(String, String, String).
protected  AbstractRichtexteditorConnector.FileUploadResult richtexteditorFileUploadResult(ActionInvocation invocation)
          Get the FileUploadResult computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#fileUpload(String, String, String, String, File).
protected  AbstractRichtexteditorConnector.Folder[] richtexteditorFolders(ActionInvocation invocation)
          Get the Folder[] computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#getFolders(String, String).
protected  AbstractRichtexteditorConnector.FoldersAndFiles richtexteditorFoldersAndFiles(ActionInvocation invocation)
          Get the FoldersAndFiles computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#getFoldersAndFiles(String, String).
protected  String stringFromDocument(Document document)
          Convert a Document to its string representation.
protected  void writeDocumentToStream(Document document, OutputStream out)
          Write a Document to an OutputStream out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.xwork.Result
execute
 

Constructor Detail

AbstractRichtexteditorResult

public AbstractRichtexteditorResult()
Method Detail

buildDocument

protected Document buildDocument()
                          throws ParserConfigurationException
Build an xml Document

Returns:
An XML Document
Throws:
ParserConfigurationException

buildCommonResponseXml

protected Element buildCommonResponseXml(Document document,
                                         String command,
                                         String type,
                                         String folderPath,
                                         String serverPath)
Build a common xml structure for all xml based result. For example:
 <?xml version="1.0" encoding="utf-8" ?>
 <Connector command="RequestedCommandName" resourceType=" RequestedResourceType">
       <CurrentFolder path="CurrentFolderPath" url="CurrentFolderUrl" />
       <!-- Here goes all specific command data -->
 </Connector>
 

Parameters:
document -
command -
type -
folderPath -
serverPath -
Returns:
A common xml structure for all xml based result.

stringFromDocument

protected String stringFromDocument(Document document)
                             throws TransformerConfigurationException,
                                    TransformerException
Convert a Document to its string representation.

Parameters:
document -
Returns:
The documents String representation.
Throws:
TransformerConfigurationException
TransformerException

writeDocumentToStream

protected void writeDocumentToStream(Document document,
                                     OutputStream out)
                              throws TransformerConfigurationException,
                                     TransformerException
Write a Document to an OutputStream out

Parameters:
document -
out -
Throws:
TransformerConfigurationException
TransformerException

getCommand

protected String getCommand(ActionInvocation invocation)
Get the command send by the Rich Text Editor. It would be one of the followings. Only valid when rich text editor issue a server-side 'Browse' not 'Upload'.
  • GetFolders
  • GetFoldersAndFiles
  • CreateFolder
  • FileUpload

Parameters:
invocation -
Returns:
The command send by the Rich Text Editor.

getType

protected String getType(ActionInvocation invocation)
Get the type send by the Rich Text Editor. It could be one of the followings:
  • Image
  • File
  • Flash

Parameters:
invocation -
Returns:
The type send by the Rich Text Editor.

getFolderPath

protected String getFolderPath(ActionInvocation invocation)
Get the folder path send by the Rich Text Editor.

Parameters:
invocation -
Returns:
The folder path send by the Rich Text Editor.

getServerPath

protected String getServerPath(ActionInvocation invocation)
Get the server path calculated from AbstractRichtexteditoConnector or its decendant through AbstractRichtexteditorConnector#calculate#calculateServerPath(String, String String)

Parameters:
invocation -
Returns:
The server path calculated from AbstractRichtexteditoConnector
See Also:
AbstractRichtexteditorConnector.calculateServerPath(String, String, String)

richtexteditorFolders

protected AbstractRichtexteditorConnector.Folder[] richtexteditorFolders(ActionInvocation invocation)
Get the Folder[] computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#getFolders(String, String). Only valid if it is a 'GetFolder' command.

Parameters:
invocation -
Returns:
The Folder[] computed from AbstractRichtexteditorConnector
See Also:
AbstractRichtexteditorConnector.getFolders(String, String)

richtexteditorFoldersAndFiles

protected AbstractRichtexteditorConnector.FoldersAndFiles richtexteditorFoldersAndFiles(ActionInvocation invocation)
Get the FoldersAndFiles computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#getFoldersAndFiles(String, String). Only valid if it is a 'GetFoldersAndFiles' command.

Parameters:
invocation -
Returns:
The FoldersAndFiles computed from AbstractRichtexteditorConnector
See Also:
AbstractRichtexteditorConnector.getFoldersAndFiles(String, String)

richtexteditorCreateFolderResult

protected AbstractRichtexteditorConnector.CreateFolderResult richtexteditorCreateFolderResult(ActionInvocation invocation)
Get the CreateFolderResult computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#createFolder(String, String, String). Only valid if it is a 'CreateFolder' command.

Parameters:
invocation -
Returns:
The CreateFolderResult computed from AbstractRichtexteditorConnector
See Also:
AbstractRichtexteditorConnector.createFolder(String, String, String)

richtexteditorFileUploadResult

protected AbstractRichtexteditorConnector.FileUploadResult richtexteditorFileUploadResult(ActionInvocation invocation)
Get the FileUploadResult computed from AbstractRichtexteditorConnector or its decendant through AbstractRichtexteditorConnector#fileUpload(String, String, String, String, File). Only valid if it is a 'FileUpload' command

Parameters:
invocation -
Returns:
The FileUploadResult computed from AbstractRichtexteditorConnector
See Also:
AbstractRichtexteditorConnector.fileUpload(String, String, String, String, java.io.File)

WebWork Project Page