chain-config.xml is not referenced in config files
--------------------------------------------------

I look at the content of struts-cookbook-1.3.2.war right now. I see
chain-config.xml file present, but it is not referenced anywhere in
the config files. For ease-of-learning purposes I suggest that it is
explicitly referenced in web.xml file. I filed a "trivial" ticket on
that.

servlet-standard chain name is not referenced in config files
-------------------------------------------------------------

chain-config.xml defines the "servlet-standard" chain. The chain is
not referenced explicitly anywhere in config files, it referenced by
ControllerConfig file. Again, I would prefer everything to be
explicitly defined in web.xml or struts-config.xml and in other
related config files to reduce amount of "magic" for a regular user.

CATALOG_NAME and COMMAND_NAME seem to be not used
-------------------------------------------------

The comment to ComposableRequestProcessor (CRP ) in says (Struts 1.3.2):

"ComposableRequestProcessor uses the Chain Of Resposibility design
pattern (as implemented by the commons-chain package in Jakarta
Commons) to support external configuration of command chains to be
used.  It is configured via the following context initialization
parameters:
* [org.apache.struts.chain.CATALOG_NAME] - Name of the Catalog in
which we will look up the Command to be executed for each request.  If
not specified, the default value is struts.
* org.apache.struts.chain.COMMAND_NAME - Name of the Command which we
will execute for each request, to be looked up in the specified
Catalog.  If not specified, the default value is servlet-standard."

I am not fond of having literal strings looking like a constant that
is buried deep in the class hierarchy. The comment should explicitly
mention that these are literal strings.

[org.apache.struts.chain.CATALOG_NAME] is in brackets, while
org.apache.struts.chain.COMMAND_NAME is not. Does this mean anything?
;-)

Default command for ControllerConfig seem to be hardcoded
---------------------------------------------------------

Now the interesting part: these strings are never referenced anywhere.
The command is initialized in ControllerConfig class:

   protected String command = "servlet-standard";

It has getter and setter, but setter does not seem to be called from anywhere.

Now the original question that I had
------------------------------------

How exactly can I set the chain for a particular request? Where
ControllerConfig.setCommand() should be called from?

Is it possible to use different chains for different conditions, say
for differnt types of requests (GET vs POST) or just for some
arbitrary condition? Where would I stick the code that validates the
condition and chooses a chain?

What if the condition can be checked in an action class in a
specifically designated method like preExecute() or something? Having
a strict correspondence of URL -> action mapping -> action class it
should be possible to hold off chain execution (at least after the
point when action class is initialized), to call the action class, to
evaluate the condition, then to choose an appropriate chain and then
to execute it and then to pass control to the action class again. Sort
of programmatic interceptors. Can I do something like that?

I don't know is dev@ the right mailing list for this kind of stuff. If
not, I will be using user@ for further emails that pertain to 1.3.*
architecture and functionality.

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to