Class AbstractFileUploadExecutor
- java.lang.Object
-
- org.wso2.carbon.ui.transports.fileupload.AbstractFileUploadExecutor
-
- Direct Known Subclasses:
AnyFileUploadExecutor,DBSFileUploadExecutor,JarZipUploadExecutor,KeyStoreFileUploadExecutor,ToolsAnyFileUploadExecutor,ToolsFileUploadExecutor
public abstract class AbstractFileUploadExecutor extends Object
This class is responsible for handling File uploads of specific file types in Carbon. The file type is decided depending on the file extensio. This class should be extended by all FileUploadExecutors- See Also:
FileUploadExecutorManager
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.axis2.context.ConfigurationContextconfigurationContextprotected static org.apache.commons.logging.Loglog
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFileUploadExecutor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckServiceFileExtensionValidity(String fileExtension, String[] allowedExtensions)abstract booleanexecute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected booleanexecuteCommon(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)This is the common method that can be used for Fileupload.protected StringgenerateUUID()protected List<org.wso2.carbon.utils.FileItemData>getAllFileItems()protected StringgetContextRoot(javax.servlet.http.HttpServletRequest request)protected StringgetErrorRedirectionPage()protected Map<String,ArrayList<org.wso2.carbon.utils.FileItemData>>getFileItemsMap()protected StringgetFileName(String fileName)protected Map<String,ArrayList<String>>getFormFieldsMap()List<String>getFormFieldValue(String formFieldName)Retrieve the form field values of the provided form field with nameformFieldNameprotected StringgetWorkingDir()protected voidparseRequest(javax.servlet.http.HttpServletRequest request)protected ListparseRequest(org.apache.commons.fileupload.servlet.ServletRequestContext requestContext)protected booleanuploadArtifacts(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uploadDirName, String[] extensions, String utilityString)This is a helper method that will be used upload main entity (ex: wsdd, jar, class etc) and its resources to a given deployer.protected FileuploadFile(javax.servlet.http.HttpServletRequest request, String repoDir, javax.servlet.http.HttpServletResponse response, String extension)
-
-
-
Method Detail
-
execute
public abstract boolean execute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws org.wso2.carbon.CarbonException, IOException- Throws:
org.wso2.carbon.CarbonExceptionIOException
-
getErrorRedirectionPage
protected String getErrorRedirectionPage()
-
parseRequest
protected void parseRequest(javax.servlet.http.HttpServletRequest request) throws FileUploadFailedException, FileSizeLimitExceededException
-
getWorkingDir
protected String getWorkingDir()
-
generateUUID
protected String generateUUID()
-
parseRequest
protected List parseRequest(org.apache.commons.fileupload.servlet.ServletRequestContext requestContext) throws org.apache.commons.fileupload.FileUploadException
- Throws:
org.apache.commons.fileupload.FileUploadException
-
checkServiceFileExtensionValidity
protected void checkServiceFileExtensionValidity(String fileExtension, String[] allowedExtensions) throws org.apache.commons.fileupload.FileUploadException
- Throws:
org.apache.commons.fileupload.FileUploadException
-
uploadFile
protected File uploadFile(javax.servlet.http.HttpServletRequest request, String repoDir, javax.servlet.http.HttpServletResponse response, String extension) throws org.apache.commons.fileupload.FileUploadException
- Throws:
org.apache.commons.fileupload.FileUploadException
-
executeCommon
protected boolean executeCommon(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws org.apache.commons.fileupload.FileUploadExceptionThis is the common method that can be used for Fileupload. extraStoreDirUUID is the name of the javascript that's going to execute on the client side at the secound run.- Parameters:
request-response-- Returns:
- Status true/fase.
- Throws:
org.apache.commons.fileupload.FileUploadException
-
uploadArtifacts
protected boolean uploadArtifacts(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String uploadDirName, String[] extensions, String utilityString) throws org.apache.commons.fileupload.FileUploadException, IOExceptionThis is a helper method that will be used upload main entity (ex: wsdd, jar, class etc) and its resources to a given deployer.- Parameters:
request-response-uploadDirName-extensions-utilityString-- Returns:
- boolean
- Throws:
IOExceptionorg.apache.commons.fileupload.FileUploadException
-
getAllFileItems
protected List<org.wso2.carbon.utils.FileItemData> getAllFileItems()
-
getContextRoot
protected String getContextRoot(javax.servlet.http.HttpServletRequest request)
-
getFormFieldValue
public List<String> getFormFieldValue(String formFieldName)
Retrieve the form field values of the provided form field with nameformFieldName- Parameters:
formFieldName- Name of the form field to be retrieved- Returns:
- List of form field values
-
getFileItemsMap
protected Map<String,ArrayList<org.wso2.carbon.utils.FileItemData>> getFileItemsMap()
-
-