Input Filtering on sequenced commands
Posted: Sat Oct 08, 2005 10:11 am
Question in relation to Input Filtering...
At the moment I'm working on an application (actually three - the code is re-usable) which utilise an input filter. One of the requirements for the input filter is to utilise a FilterData class (simply a definition of expected input data keys, value types, and validation rules). Now in the application I am utilising an Application Controller, i.e. requests can be mapped to a series of application logic parcels (basically a class using the Command pattern) and a view.
At present data is filtered once - on a per command basis. The problem is that once data is filtered for one command, it will of course filter out data required for subsequent commands (in the application controller's queue). One solution is to maintain a copy of the original input data and re-filter for every command - but that seems overkill, given the Request data (encapsulated in an object) would keep shifting and being refreshed, i.e. multiple Request object copies would be required - making the passing of Request objects throughout the application complex at best and completely confusing at worst. Sounds very messy. The other is to know all commands being called in advance - but then that requires data be filtered further into the application (rather than it being the first task performed).
Messy only begins to describe the situation...
Maybe its my inexperience in using an Application Controller (usually I go with FrontController or the simplicity of PageControllers where only one command is ever required, and command usually duplicate a lot of re-usable code) but is there an obvious solution for all this I am missing??? I only want each command to receive data it itself expects - in the interests of keeping any possible non-expected data leakage to the absolute minimum... Maybe this strategy is simply too strict itself...
At the moment I'm working on an application (actually three - the code is re-usable) which utilise an input filter. One of the requirements for the input filter is to utilise a FilterData class (simply a definition of expected input data keys, value types, and validation rules). Now in the application I am utilising an Application Controller, i.e. requests can be mapped to a series of application logic parcels (basically a class using the Command pattern) and a view.
At present data is filtered once - on a per command basis. The problem is that once data is filtered for one command, it will of course filter out data required for subsequent commands (in the application controller's queue). One solution is to maintain a copy of the original input data and re-filter for every command - but that seems overkill, given the Request data (encapsulated in an object) would keep shifting and being refreshed, i.e. multiple Request object copies would be required - making the passing of Request objects throughout the application complex at best and completely confusing at worst. Sounds very messy. The other is to know all commands being called in advance - but then that requires data be filtered further into the application (rather than it being the first task performed).
Messy only begins to describe the situation...
Maybe its my inexperience in using an Application Controller (usually I go with FrontController or the simplicity of PageControllers where only one command is ever required, and command usually duplicate a lot of re-usable code) but is there an obvious solution for all this I am missing??? I only want each command to receive data it itself expects - in the interests of keeping any possible non-expected data leakage to the absolute minimum... Maybe this strategy is simply too strict itself...