We are creating a base action to manage export function. This base class deals 
with file name and content type. 
public class public abstract class AbstractExportAction{ //Will be override 
protected abstract InputStream exportInputStream() ; @Action(value = "export", 
results = { @Result(name = "success", type = "stream", params = { "inputName", 
"inputStream", "contentType", "${exportContentType}; charset=UTF-8", 
"Content-Disposition", "attachment; filename=\"${filename}\"", 
"contentDisposition", "attachment; filename=\"${filename}\"", "bufferSize", 
"2048" }) }) public String export() throws ClientException {     inputStream = 
exportInputStream(); LOG.debug("Exporting to {} file ", getFilename());     
return SUCCESS; }
//setter getters for filename and exportContentType } 
Now the other actions extend above class and return they own data as InputStream
package action.account;
public class AccountsSummary extends AbstractExportAction { @Override protected 
InputStream exportInputStream() { } } 
*We have /account/export.action without any need to deal with file name and 
content *
Generally every thing works fine, but in below case, the export action will not 
map to correct class:
        * Action A extends AbstractExportAction 
        * Action B extends AbstractExportAction 
        * Action A and B  are in same namespace (package) 
In above case, struts ( struts convention plugin) randomly took one action A or 
B and map export action to that class.
Do you think we are using correct approach?!
 
~Regards,
~~Alireza Fattahi

Reply via email to