You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mark Shifman <ma...@yale.edu> on 2006/09/26 20:06:22 UTC

how to initialize custon-chain.config

HI;
I am starting to play with chains and commands in 1.3.5 and I was 
wondering where I  initialize the my custom chains ?
I don't want to mess with the request processor, just add a few command 
chains of my own.

The cookbook mail reader example from commons.chain uses a context-param 
and listener:
>     <context-param>
>         <param-name>org.apache.commons.chain.CONFIG_CLASS_RESOURCE</param-name>
>         <param-value>resources/catalog.xml</param-value>
>     </context-param>
>
>     <listener>
>         <listener-class>org.apache.commons.chain.web.ChainListener</listener-class>
>     </listener>
The javadocs for Action servlet and Better Code With Struts 1.3 article 
http://www.infonoia.com/en/content.jsp?d=inf.05.06&pr=1
say it should go as an init-param in the servlet section of the web.xml 
(from the article)
> <init-param>
>  <param-name>chainConfig</param-name>
>  <param-value>/WEB-INF/config/chain-config.xml,
>  /WEB-INF/modules/test/inf/chainTest.xml</param-value>
>  </init-param>
Do I need to extract the chain-config.xml from the struts-core.jar and 
include it in my WEB-INF along with my custom-chain-config.xml
or is struts smart enough to configure itself without me extracting it 
and then create my custom catalog?

Thanks in advance.
mas

 mark.shifman@yale.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to initialize custon-chain.config

Posted by Mark Shifman <ma...@yale.edu>.
Thanks Wendy,
I used:
<init-param>
 <param-name>chainConfig</param-name>
<param-value>org/apache/struts/chain/chain-config.xml,  /WEB-INF/ 
custom-chain-config..xml</param-value>
 </init-param>

And it worked!
The first loads the "struts" catalog and the second load my own catalog.
Thanks again,

Mark Shifman

Wendy Smoak wrote:
> On 9/26/06, Mark Shifman <ma...@yale.edu> wrote:
>> HI;
>> I am starting to play with chains and commands in 1.3.5 and I was
>> wondering where I  initialize the my custom chains ?
>> I don't want to mess with the request processor, just add a few command
>> chains of my own.
> ...
>> Do I need to extract the chain-config.xml from the struts-core.jar and
>> include it in my WEB-INF along with my custom-chain-config.xml
>> or is struts smart enough to configure itself without me extracting it
>> and then create my custom catalog?
>
> Yes, Struts will find its default Chain config file inside the jar.
> Even if you did need to specify it, you would not need to extract it
> from the jar.
>
> For example, you can use the provided chain config for Tiles (in an
> init param for the Action servlet):
>    <init-param>
>        <param-name>chainConfig</param-name>
>        
> <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
>    </init-param>
> and it will be loaded from the struts-tiles.jar.
>
> Your context param and ChainListener should work fine.
>
> I think (but have not verified) that you can also use the chainConfig
> init param for ActionServlet to load your own catalogs.  If you do
> that, you'll probably have to specify the default file in addition to
> your own files.  The path to the default file should be
> 'org/apache/struts/chain/chain-config.xml'.
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: how to initialize custon-chain.config

Posted by Wendy Smoak <ws...@gmail.com>.
On 9/26/06, Mark Shifman <ma...@yale.edu> wrote:
> HI;
> I am starting to play with chains and commands in 1.3.5 and I was
> wondering where I  initialize the my custom chains ?
> I don't want to mess with the request processor, just add a few command
> chains of my own.
...
> Do I need to extract the chain-config.xml from the struts-core.jar and
> include it in my WEB-INF along with my custom-chain-config.xml
> or is struts smart enough to configure itself without me extracting it
> and then create my custom catalog?

Yes, Struts will find its default Chain config file inside the jar.
Even if you did need to specify it, you would not need to extract it
from the jar.

For example, you can use the provided chain config for Tiles (in an
init param for the Action servlet):
    <init-param>
        <param-name>chainConfig</param-name>
        <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
    </init-param>
and it will be loaded from the struts-tiles.jar.

Your context param and ChainListener should work fine.

I think (but have not verified) that you can also use the chainConfig
init param for ActionServlet to load your own catalogs.  If you do
that, you'll probably have to specify the default file in addition to
your own files.  The path to the default file should be
'org/apache/struts/chain/chain-config.xml'.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org