From a given alias (eg
'/products/search') both a default Action would need to be found and a
default Result.
Currently the behaviour of this search is defined
by the abstract factory, DefaultActionProxyFactory. This factory creates a
DefaultActionProxy instance which creates an ActionInvocation from
the runtime config on each request. It is in the
DefaultActionInvocation that the action class and result class are
instantiated.
I suggest that if an ActionConfig is not found in
the runtime config then a default one is created and cached for future
use. This would occur in the DefaultActionProxy class at the time of
lookup. The class name would be derived from the action name
('search' becomes 'SearchAction'). The package would come from the
<default-action-package> defined for the package (ie
'com.mycompany.myapp') and the action namespace and action name would be
appended giving 'com.mycompany.myapp.products.SearchAction'.
The Result type (for WW) would normally be either
ServletDispatcherResult or VelocityResult. This would require the
functionality to be configurable (ie not a part of XWork). The WW default
config could define a <default-result-factory> element which defines the
class that contains the logic for the result search.
For example, a
ServletDispatcherDefaultResultFactory could define the logic to find the correct
jsp page. By default it would look for a file named
'/products/search.jsp'. If the jsp file is found then the factory would
return a ResultConfig object which would be cached for future use against the
result key 'SUCCESS' (maybe 'INPUT' also). Global results could be
accessed from the action also (eg LOGIN).
These factories could be chained together so that
applications that use XWork can define an ordered succession of factories
(eg look for jsp then velocity templates).
When extending a package with another package the
default behaviour could also be extended. Another java package may be
defined in which to search for actions or an additional factory could be added
to create ResultConfig's.
For the end user in the most simple case they would
not have to create *any* additional configuration. They could create
action classes in the default package (no package name) and jsp's or vm's in the
web root.
The config browser xwork.xml file would
become:
<xwork>
<include file="webwork-default.xml"/> <package name="default" extends="webwork-default"
namespace="/">
<default-action-package>com.opensymphony.webwork.config_browser</default-action-package>
<interceptors> <interceptor-stack name="config-browser-default"> <interceptor-ref name="component"/> <interceptor-ref name="validationWorkflowStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="config-browser-default"/> <global-results> <result name="error" type="velocity">error.vm</result> </global-results> </package> </xwork> Now that would be simple!
John.
----- Original Message -----
|
Title: Message
- Re: [OS-webwork] Simplicity of W... boxed
- RE: [OS-webwork] Simplicity ... Drew McAuliffe
- Re: [OS-webwork] Simplicity of W... ian
- Re: [OS-webwork] Simplicity of W... Hani Suleiman
- Re: [OS-webwork] Simplicity ... Mike Cannon-Brookes
- Re: [OS-webwork] Simplicity ... Hani Suleiman
- Re: [OS-webwork] Simplicity of WW2 - ... Lars Fischer
- Re: [OS-webwork] Simplicity of WW2 ian
- RE: [OS-webwork] Simplicity of WW2 Drew McAuliffe
- RE: [OS-webwork] Simplicity of WW2 Jason Carreira
- Re: [OS-webwork] Simplicity of WW2 John Patterson
- Re: [OS-webwork] Simplicity of WW2 Pat Lightbody
- Re: [OS-webwork] Simplicity of WW2 Rene Gielen
- RE: [OS-webwork] Simplicity of WW2 Drew McAuliffe
- RE: [OS-webwork] Simplicity of WW2 Jason Carreira
- RE: [OS-webwork] Simplicity of WW2 Drew McAuliffe
- RE: [OS-webwork] Simplicity of WW2 Jason Carreira
- Re: [OS-webwork] Simplicity of WW2 John Patterson
- RE: [OS-webwork] Simplicity of WW2 Jason Carreira