struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koji (JIRA)" <>
Subject [jira] Commented: (WW-3115) Provide a way to inject file upload listener for JakartaMultipartRequest
Date Sat, 09 May 2009 08:13:42 GMT


Koji commented on WW-3115:

I think that JakartaMultipartRequest should instantiate ServletFileUpload via a factory so
we could simply subclass it and override the factory method, eg:

//On JakartaMultiPartRequest
protected ServletFileUpload create(FileItemFactory fac){
 return new ServletFileUpload(fac); 

//On MyMultipartRequest

protected ServletFileUpload create(FileItemFactory factory){
 ServletFileUpload upload  = super.create(fac);

//add progress listeners
return upload;

As it stands now I have to duplicate the parse method and the createRequestContext method.

> Provide a way to inject file upload listener for JakartaMultipartRequest
> ------------------------------------------------------------------------
>                 Key: WW-3115
>                 URL:
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>    Affects Versions: 2.1.6
>         Environment: ALL
>            Reporter: Dharshana
>            Priority: Minor
> I'd like to have a way to have a configurable upload listener to be used by JakartaMultipartRequest
so any application can monitor the progress of a file upload without having to write own uploader
classes or using any plugins
> listener can be attached to the uploader on the following lines on per upload basis
>    88               ServletFileUpload upload = new ServletFileUpload(fac);
>    89               upload.setSizeMax(maxSize);
> e.g.
> String monitorKey  = request.getParameter("UPLOAD_MONITOR_KEY");
> if (monitorKey  != null){
>     //Create a progress listener using the configuration information, this is what I
need from this feature request
>     ProgressListener progressListener = createProgressListener();
>     upload.setProgressListener(progressListener );
>     request.getSession.putAttribute(monitorKey  ,progressListener );
>    //Now the application will be able to monitor the upload progress asynchronously
> }

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message