public class UploadToStreamCmdImpl extends ControllerCommandImpl implements UploadToStreamCmd
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright.
|
defaultCommandClassName
Constructor and Description |
---|
UploadToStreamCmdImpl() |
Modifier and Type | Method and Description |
---|---|
long |
getAttachmentOwner()
This method gets the creator of the uploaded attachment, that is, the user who logs on to the store.
|
java.io.InputStream |
getAttachmentStream()
This method gets the attachment stream from when the upload is completed.
|
java.lang.String |
getErrorURL()
This method gets the
errorURL where the user should be redirected when an error occurs
during upload. |
java.lang.String |
getFileName()
This method gets the
fileName of the uploaded file. |
long |
getFileSize()
This method gets the
filesize of the uploaded file. |
java.lang.String |
getRootPath()
This method gets the
rootPath where the file should be uploaded. |
java.lang.String |
getUrl()
This method gets the
URL to be returned when the upload is completed. |
void |
performExecute()
This method contains the main business logic of this command.
|
void |
setErrorURL(java.lang.String errorURL)
This method sets the
errorURL to be forwarded to when an error occurs during upload. |
void |
setRefCmd(java.lang.String name)
This method sets the
refcmd of the command which extends this command. |
void |
setRequestProperties(TypedProperty reqParms)
This method sets the request properties.
|
void |
setRootPath(java.lang.String path)
This method sets the
rootPath where the file should be uploaded. |
void |
setUrl(java.lang.String returnURL)
This method sets the
URL to be returned/redirected when the upload is completed. |
void |
validateParameters()
This method checks the validity of the parameters.
|
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputProperties
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
fulfills, getOwner
public static final java.lang.String COPYRIGHT
public java.io.InputStream getAttachmentStream()
getAttachmentStream
in interface UploadToStreamCmd
InputStream
object that represents the attachment upload stream.public void setErrorURL(java.lang.String errorURL)
errorURL
to be forwarded to when an error occurs during upload.errorURL
- The URL
to be forwarded to when an error occurs during upload.public void setRefCmd(java.lang.String name)
refcmd
of the command which extends this command.
The refcmd
should match the command name in attachment configuration in the
<instance_name>.xml
file. It should also be the commandName
in the
command context, that is, the URL
command that extends the UploadToStreamCmd
.name
- The reference command name.public void setUrl(java.lang.String returnURL)
URL
to be returned/redirected when the upload is completed.name
- A String
that represents the returnURL
.public java.lang.String getFileName()
fileName
of the uploaded file.getFileName
in interface UploadToStreamCmd
String
that represents the fileName
.public java.lang.String getUrl()
URL
to be returned when the upload is completed.getUrl
in interface UploadToStreamCmd
String
that represents the URL
.public java.lang.String getErrorURL()
errorURL
where the user should be redirected when an error occurs
during upload.String
that represents the errorURL
.public long getFileSize()
filesize
of the uploaded file.getFileSize
in interface UploadToStreamCmd
long
value that represents the size of the uploaded file.public long getAttachmentOwner()
getAttachmentOwner
in interface UploadToStreamCmd
long
value that represents the owner_id
of the user who uploads
the attachment.public void setRootPath(java.lang.String path)
rootPath
where the file should be uploaded.path
- A String
that represents the rootpath
.public java.lang.String getRootPath()
rootPath
where the file should be uploaded.String
that represents the rootpath
.public void setRequestProperties(TypedProperty reqParms) throws ECException
refcmd
,
filepath
, rename
, filename
, and errorURL
.
This method gets the user_id
and store_id
from the command context
It gets the configurable parameters maxuploadsize
, viruscheck
and the
supportedfile
extension from <instance_name>.xml
based on
refcmd
.setRequestProperties
in interface ControllerCommand
setRequestProperties
in class ControllerCommandImpl
reqParms
- The request parameters.ECException
-
Thrown with the message ECMessage._ERR_CMD_INVALID_PARAM
when an unexpected error occurs when processing the command parameters.
Thrown with the message ECMessage._ERR_REMOTE_EXCEPTION
when a remote error occurs.
Thrown with the message ECMessage._ERR_UPLOAD_REFCMD_MISSING_CONFIG_PARAMS
when there is no configuration for the refcmd
in the <instance_name>.xml
file
ContollerCommand#setRequestProperties()
public void validateParameters() throws ECException
validateParameters
in interface ECCommand
validateParameters
in class AbstractECTargetableCommand
ECException
-
Thrown with the message ECMessage._ERR_UPLOAD_MISSING_REFCMD
when refcmd
is missing from the <instance_name>.xml
file attachment configuration section.
Thrown with the message ECMessage._ERR_UPLOAD_FILECONTENTTYPE_NOTALLOWED
when the contenttype
of the upload file does not match the file extension.
Thrown with the message ECMessage._ERR_UPLOAD_FILETYPE_NOTALLOWED
when the file type is not contained in supportedfileextension
as specified in the attachment configuration.
Thrown with the message ECMessage._ERR_UPLOAD_FILESIZE_TOOBIG
when the filesize
exceeds the maximum allowable size in the attachment configuration section of the <instance_name>.xml
file.
public void performExecute() throws ECException
performExecute
in interface ECCommand
performExecute
in interface com.ibm.websphere.command.TargetableCommand
performExecute
in class AbstractECTargetableCommand
ECException
ControllerComand#performExecute