|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.struts.action.Action
com.jcorporate.expresso.core.controller.Controller
com.jcorporate.expresso.core.controller.DBController
com.jcorporate.expresso.ext.controller.Download
The download controller provides a ready-to-use component for people to download files through. See DBObject for the data definition objects that support this controller
Features supported include:
DownloadFiles,
MimeTypes,
DownloadLog,
Serialized Form| Field Summary |
| Fields inherited from class com.jcorporate.expresso.core.controller.Controller |
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN |
| Fields inherited from class org.apache.struts.action.Action |
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY |
| Constructor Summary | |
Download()
|
|
| Method Summary | |
protected void |
checkIsAllowed(ControllerRequest request,
User u,
DownloadFiles file)
Checks file permissions and throws an Exception, and logs an event if the user does not have permission to run. |
protected String |
getDownloadTime(ControllerResponse response,
long fileLength)
Returns a string estimating download time at 28.8k This function assumes a download rate of 5 Mb / minute |
protected String |
getFriendlyName(DownloadFiles oneDownloadFile)
Returns the friendly download name |
protected DownloadFiles |
getThisDownloadFile(ControllerRequest request,
User u)
Convenience method to retrieve the download file based upon the file parameter |
String |
getTitle()
Returns title of this controller |
protected boolean |
isAllowed(ControllerRequest request,
DownloadFiles oneFile,
User myUser)
Is it allowed for this user to download this particular file? |
protected void |
logInvalidFileRequest(ControllerRequest request,
User myUser)
Sets off the system event for an invalid file number requested. |
protected void |
returnFile(String filename,
OutputStream out)
Sends the contents of the specified file to the output stream |
protected ControllerResponse |
runBeginState(ControllerRequest request,
ControllerResponse response)
Starts a download for a file. |
protected ControllerResponse |
runDownloadState(ControllerRequest controllerRequest,
ControllerResponse controllerResponse)
Returns the file actually requested by the user. |
protected ControllerResponse |
runListState(ControllerRequest request,
ControllerResponse response)
Lists the files available for download. |
protected void |
runViewNotesState(ControllerRequest request,
ControllerResponse response)
View the notes associated with the download. |
| Methods inherited from class com.jcorporate.expresso.core.controller.DBController |
getString, isAllowed, stateAllowed |
| Methods inherited from class org.apache.struts.action.Action |
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Download()
| Method Detail |
protected DownloadFiles getThisDownloadFile(ControllerRequest request,
User u)
throws ControllerException
request - The ControllerRequest objectu - the User requesting
ControllerException - upon illegal inputs
protected ControllerResponse runBeginState(ControllerRequest request,
ControllerResponse response)
throws ControllerException
request - The controller request object handed to us by
the frameworkresponse - The controller Response that this class fills out.
ControllerException - if there's an error with the processing of the
request.
protected ControllerResponse runListState(ControllerRequest request,
ControllerResponse response)
throws ControllerException
request - The controller request object handed to us by
the frameworkresponse - The controller Response that this class fills out.
ControllerException - if there's an error with the processing of the
request.for more information
protected ControllerResponse runDownloadState(ControllerRequest controllerRequest,
ControllerResponse controllerResponse)
throws ControllerException
controllerRequest - The controller request object handed to us by
the frameworkcontrollerResponse - The controller Response that this class fills out.
ControllerException - if there's an error with the processing of the
request.
protected void returnFile(String filename,
OutputStream out)
throws FileNotFoundException,
IOException
filename - the file to sendout - the output stream to write the file
FileNotFoundException - if the file does not exist
IOException - if an I/O error occurs
protected boolean isAllowed(ControllerRequest request,
DownloadFiles oneFile,
User myUser)
throws DBException
request - The Controller Request object passed to the controller state handleroneFile - The download file definitionmyUser - The user making the controller request.
DBException - upon database access error
protected void logInvalidFileRequest(ControllerRequest request,
User myUser)
throws ControllerException
request - The Controller Request object sent to this controller for
the state handler.myUser - The logged-in definition of the user currently logged in.
ControllerException - if the download file number was invalid.
protected String getFriendlyName(DownloadFiles oneDownloadFile)
throws ControllerException,
DBException
oneDownloadFile - The download file definition object
ControllerException - if the record is mal-formed
DBException - if there's an error accessing the database.DownloadFiles
protected String getDownloadTime(ControllerResponse response,
long fileLength)
throws ControllerException
response - The controller response object to get the requesting
user's Locale.fileLength - The length of the file to calculate.
ControllerException - if the download time is unable to get the
internationalized strings for Minutes and Seconds.
protected void checkIsAllowed(ControllerRequest request,
User u,
DownloadFiles file)
throws ControllerException
request - the ControllerRequest objectu - the user requesting the filefile - the file to download
ControllerException - if the file is not allowed for the given
user.public String getTitle()
getTitle in class Controller
protected void runViewNotesState(ControllerRequest request,
ControllerResponse response)
throws ControllerException
request - The controller request object handed to us by
the frameworkresponse - The controller Response that this class fills out.
ControllerException - upon error [data access or otherwise]
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||