Package org.ametys.plugins.core.upload
Class UploadAction
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,ThreadSafe,Action
- Direct Known Subclasses:
CropImageAction,UploadAction
Action for uploading a file and store it using the UploadManager.-
Field Summary
FieldsFields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidDo upload the file and fill the result map.protected void_fillSuccess(Upload upload, Map<String, Object> result) Fill the result map.protected PartGets thePartobject which is trying to be uploadedprotected String_getUrlForDownload(Upload upload) Get the url for download the uploaded fileprotected String_getUrlForView(Upload upload) Get the url for view the uploaded fileprotected void_handleStoreUploadException(IOException e, Object obj, Map<String, Object> result) Handles a store upload exception by filling the result map with information about the exception.protected voidLookup components (lazy initialize)protected void_storeUpload(InputStream is, String filename, Map<String, Object> result) Stores the given upload data (as anInputStream) into theUploadManagersystem and fill the result map.act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) Methods inherited from class org.ametys.core.util.cocoon.AbstractCurrentUserProviderServiceableAction
_getCurrentUserMethods inherited from class org.apache.cocoon.acting.ServiceableAction
serviceMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_uploadManager
The Upload Manager
-
-
Constructor Details
-
UploadAction
public UploadAction()
-
-
Method Details
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
_lookupComponents
Lookup components (lazy initialize)- Throws:
ServiceException- If some components cannot be looked up
-
_doUpload
protected void _doUpload(Request request, Parameters parameters, Map<String, Object> result) throws ExceptionDo upload the file and fill the result map.- Parameters:
request- The requestparameters- The parametersresult- The result map to fill- Throws:
Exception- if an error occurs.
-
_getPart
Gets thePartobject which is trying to be uploaded -
_storeUpload
protected void _storeUpload(InputStream is, String filename, Map<String, Object> result) throws IOExceptionStores the given upload data (as anInputStream) into theUploadManagersystem and fill the result map.- Parameters:
is- The upload datafilename- The file nameresult- The result map to fill- Throws:
IOException- if an I/O error occurs
-
_fillSuccess
Fill the result map.- Parameters:
upload- The uploadresult- The result map to fill
-
_handleStoreUploadException
Handles a store upload exception by filling the result map with information about the exception.- Parameters:
e- The exceptionobj- The object representing the upload data (for logging purpose)result- The result map to fill
-
_getUrlForView
Get the url for view the uploaded file- Parameters:
upload- The file uploaded- Returns:
- The url for view
-
_getUrlForDownload
Get the url for download the uploaded file- Parameters:
upload- The file uploaded- Returns:
- The url for view
-