DWR

Debug/Test page does not work when using spring to manage DWR

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 3.0.RC1
  • Fix Version/s: 4.0
  • Component/s: Spring
  • Description:
    Hide
    I had read about the test/debug page not working when configuring DWR with spring in this thread : http://markmail.org/thread/mejilqhtztnqdsd6. I tried to test it myself anyway just to make sure. I can confirm what John Gordon said in this thread here : http://markmail.org/message/46hqenkirszc3hys. The test page infact does not work however if you browse directly to the test page of the bean, it works.

    I searched for the issue in jira using the terms "test page" but didn't find any hits so i'm reporting this now. I have also attached my configuration and a sample java file for you to test with. The java file is a little dirty and only the getStuff() method is exposed.
    Show
    I had read about the test/debug page not working when configuring DWR with spring in this thread : http://markmail.org/thread/mejilqhtztnqdsd6. I tried to test it myself anyway just to make sure. I can confirm what John Gordon said in this thread here : http://markmail.org/message/46hqenkirszc3hys. The test page infact does not work however if you browse directly to the test page of the bean, it works. I searched for the issue in jira using the terms "test page" but didn't find any hits so i'm reporting this now. I have also attached my configuration and a sample java file for you to test with. The java file is a little dirty and only the getStuff() method is exposed.
  1. dwrexample-servlet.xml
    (2 kB)
    Gaurav Arora
    21/Feb/09 7:26 AM
  2. JdbcGeneralDao.java
    (3 kB)
    Gaurav Arora
    21/Feb/09 7:26 AM
  3. test-url.patch
    (0.7 kB)
    Jose Noheda
    01/Apr/09 11:07 AM
  4. web.xml
    (2 kB)
    Gaurav Arora
    21/Feb/09 7:26 AM

Activity

Hide
David Marginian added a comment - 26/Mar/09 11:31 AM

Jose,

The mappings are currently:

Map<String, Object> mappings = new HashMap<String, Object>();
mappings.put("/engine.js", handler);
mappings.put("/util.js", handler);
mappings.put("/interface/**", handler);
mappings.put("/call/**", handler);
mappings.put("/test/**", handler);
mappings.put("/download/**", handler);

If we change the mappings to:
<prop key="/dwr/*/">dwrController</prop>

In order for this to work we need to call setAlwaysUseFullPath(true); in DwrHandlerMapping.

Is there a problem with this approach?

Show
David Marginian added a comment - 26/Mar/09 11:31 AM Jose, The mappings are currently: Map<String, Object> mappings = new HashMap<String, Object>(); mappings.put("/engine.js", handler); mappings.put("/util.js", handler); mappings.put("/interface/**", handler); mappings.put("/call/**", handler); mappings.put("/test/**", handler); mappings.put("/download/**", handler); If we change the mappings to: <prop key="/dwr/*/">dwrController</prop> In order for this to work we need to call setAlwaysUseFullPath(true); in DwrHandlerMapping. Is there a problem with this approach?
Hide
Jose Noheda added a comment - 26/Mar/09 11:59 AM

You would be forcing a specific mapping for the servlet in web.xml which is undesired. The best solution I can come with is to name the test page dwr-test.html or something like that instead of index.html (a mapping I'm hesitant to add).

Show
Jose Noheda added a comment - 26/Mar/09 11:59 AM You would be forcing a specific mapping for the servlet in web.xml which is undesired. The best solution I can come with is to name the test page dwr-test.html or something like that instead of index.html (a mapping I'm hesitant to add).
Hide
David Marginian added a comment - 26/Mar/09 8:22 PM

Jose if the proposed solution is OK with you, I can get this change in if you are busy.

Show
David Marginian added a comment - 26/Mar/09 8:22 PM Jose if the proposed solution is OK with you, I can get this change in if you are busy.
Hide
Jose Noheda added a comment - 01/Apr/09 11:07 AM

This is the easiest way I've come across. In addition to being mapped at /app/dwr/index.html it's mapped at /app/dwr/test/index.html. Outside Spring both urls work, inside Spring just the later (when using <dwr:url-mapping /> of course).

The solution is not pretty but there's no better alternative IMHO. The problem is inherited from DWR core where URLs like index.html or /test/ aren't avoided. This works fine as long as DWR serves everything but becomes problematic when the servlet is shared (as is with SpringMVC).

I'm not committing anything though. And I would raise another issue to sandbox this problem using a proprietary namespace (which would be real solution but requires consensus)

Show
Jose Noheda added a comment - 01/Apr/09 11:07 AM This is the easiest way I've come across. In addition to being mapped at /app/dwr/index.html it's mapped at /app/dwr/test/index.html. Outside Spring both urls work, inside Spring just the later (when using <dwr:url-mapping /> of course). The solution is not pretty but there's no better alternative IMHO. The problem is inherited from DWR core where URLs like index.html or /test/ aren't avoided. This works fine as long as DWR serves everything but becomes problematic when the servlet is shared (as is with SpringMVC). I'm not committing anything though. And I would raise another issue to sandbox this problem using a proprietary namespace (which would be real solution but requires consensus)

People

Dates

  • Created:
    21/Feb/09 7:26 AM
    Updated:
    10/Dec/10 9:22 PM