Convention Plugin breaks DWR integration
----------------------------------------

                 Key: WW-2969
                 URL: https://issues.apache.org/struts/browse/WW-2969
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - Convention
    Affects Versions: 2.1.6
         Environment: Jetty 6.1.14 on Windows XP Pro
Struts2 2.1.6 with Convention plugin
DWR 2.0.3
            Reporter: Brian Curnow


This may not be an actual bug and be "broken" this way be design. In reading 
through the documentation (http://struts.apache.org/2.1.6/docs/webxml.html) 
it's recommended that you map the Struts 
FilterDispatcher/StrutsPrepareAndExecuteFilter to the URL pattern "/*". This 
seems to work fine with what I'll call traditional Struts2 (i.e. no Convention 
plugin) and also with the Convention plugin.

I'm attempting to use DWR 2.0 and their documentation has you map the 
dwr-invoker (I'm using the Spring version: 
org.directwebremoting.spring.DwrSpringServlet) to the URL pattern "/dwr/*" 
(http://directwebremoting.org/dwr/server/servlet). This works fine in 
traditional Struts2 but breaks when using the Convention plugin.

What I get  when I attempt to hit http://localhost:8080/dwr is an error: "There 
is no Action mapped for namespace / and action name dwr." I can work around 
that error by using http://localhost:8080/dwr/index.html however, when clicking 
on a link on the DWR page (to see information about one of my exposed classes) 
I get a similar error: "There is no Action mapped for namespace /dwr/test and 
action name MessageBean."

I believe this is caused because the Convention plugin treats URLs it can't 
resolve as errors instead of falling back on the web container to handle them. 
This doesn't seem to be an issue for URLs which actually map back to files, for 
example, http://localhost:8080/styles/menu.css works just fine and returns the 
menu.css file in my <web app root>/styles directory. Like I said earlier, this 
may have been by design.

I've worked around this two ways:

1. Resetting struts.action.extension to be simply "action", since none of the 
DWR URLs using .action, this is working but now I have that darn .action in my 
URLs again
2. Adding a package-info.java to my base Action package and setting a namespace 
(@org.apache.struts2.convention.annotation.Namespace(value="/action")) and then 
changing the filter mapping in web.xml to only look for /action/* (and moving 
the results files as well)

Neither of those solutions is, in my opinion, very attractive and it seems that 
if traditional struts2 can support the DWR URLs that the Convention plugin 
should be able to support them too.

Is this an actual bug and can it be fixed or is there another workaround?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to