Dear friends
our web application's action classes' methods depend upon web-helper objects.
so this scenario is typical
public ActionForward dispatch-method-xyz(ActionMapping mapping,
ActionForm form,
ServletRequest request,
ServletResponse response){
helperobjectclass helperobject = new helperobjectclass();
//do sth on helper object that returns some data.
}
I have a peculiar requirement to set the helper object at runtime..so that i can pass in a dummy helper or a real helper object. So, i refactored the helper creation from nside of Action's method and placed it in a setter method like this.
//Note that i also have a common interface for real and dummy helper objects.
setHelperObject(HelperObjectInterface helperIntf){
Assign to Action instance's interface variable
}
I plan to override processActionCreate( method in RequestProcessor that returns an Action instance for the specific request path. I wish to set the appropriate helper to the Action here.
See that this has a similarity to spring framework where you can set Action's methods.
Now,
1. Please comment on the process above. Any comments?
2. Do anybody see any issues now that i am exposing helper related objects as instance level of Action's?(as i have to set them instead of creating inside Action methods as before)
Comments invited.
thanks in advance.
our web application's action classes' methods depend upon web-helper objects.
so this scenario is typical
public ActionForward dispatch-method-xyz(ActionMapping mapping,
ActionForm form,
ServletRequest request,
ServletResponse response){
helperobjectclass helperobject = new helperobjectclass();
//do sth on helper object that returns some data.
}
I have a peculiar requirement to set the helper object at runtime..so that i can pass in a dummy helper or a real helper object. So, i refactored the helper creation from nside of Action's method and placed it in a setter method like this.
//Note that i also have a common interface for real and dummy helper objects.
setHelperObject(HelperObjectInterface helperIntf){
Assign to Action instance's interface variable
}
I plan to override processActionCreate( method in RequestProcessor that returns an Action instance for the specific request path. I wish to set the appropriate helper to the Action here.
See that this has a similarity to spring framework where you can set Action's methods.
Now,
1. Please comment on the process above. Any comments?
2. Do anybody see any issues now that i am exposing helper related objects as instance level of Action's?(as i have to set them instead of creating inside Action methods as before)
Comments invited.
thanks in advance.