CompositeActionMapper

2007-03-20 Thread Deryl Seale
I am having some trouble getting the CompositeActionMapper to work  
properly.  I have the following specified in my struts.properties:


struts.mapper.class=org.apache.struts2.dispatcher.mapper.CompositeAction 
Mapper
struts.mapper.composite=org.apache.struts2.dispatcher.mapper.DefaultActi 
onMapper,org.apache.struts2.dispatcher.mapper.RestfulActionMapperorg.apa 
che.struts2.dispatcher.mapper.Restful2ActionMapper


I have verified that my application is using the  
CompositeActionMapper, but I always get a 404 error when trying any  
URL for my application.  After some digging, I have traced the issue  
to the setActionMappings method in CompositeActionMapper:


@Inject(StrutsConstants.STRUTS_MAPPER_COMPOSITE)
public void setActionMappers(String list) {
if (list != null) {
String[] arr = list.split(,);
for (String name : arr) {
Object obj = container.getInstance 
(ActionMapper.class, name);

if (obj != null) {
actionMappers.add((ActionMapper) obj);
}
}
}
}

I verified that the list of mappers I want to use is being passed in  
to this method correctly.  When it invokes the container.getIntance()  
method, however, the result is always null.  Thus, the actionMappers  
list in CompositeActionMapper is always empty, and every request gets  
a null value, and hence a 404 error.


My question is: am I missing some step in the configuration?  Is  
there a reason why CompositeActionMapper can't get references to the  
ActionMappers I specify?


thanks!
--Deryl





Re: CompositeActionMapper

2007-03-20 Thread Deryl Seale
Yes, I tried that, and all I got was an exception when I started up  
the application saying that an ActionMapper with the name struts  
had already been loaded, presumedly from struts-default.xml.  If  
there is a way to make Struts use CompositeActionMapper with some  
configuration entry in struts.xml, it is not obvious to me how to do  
it (in spite of the documentation).


--Deryl

On Mar 20, 2007, at 10:26 AM, Dave Newton wrote:


--- Deryl Seale [EMAIL PROTECTED] wrote:

I am having some trouble getting the
CompositeActionMapper to work
properly.  I have the following specified in my
struts.properties:
[...]


Have you tried it like this in struts.xml?

bean
type=org.apache.struts2.dispatcher.mapper.ActionMapper

  name=struts

class=org.apache.struts2.dispatcher.mapper.CompositeActionMapper
/
constant name=struts.mapper.composite

value=org.apache.struts2.dispatcher.mapper.DefaultActionMapper,foo.ba 
r.MyActionMapper,foo.bar.MyAnotherActionMapper

/

(I haven't; this is what's in the API docs, though,
and I tend to avoid the properties file.)

d.




__ 
__

No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

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



--
Deryl Seale -- Director of Engineering
c: 734.883.9636
[EMAIL PROTECTED]
www.intel-assess.com