Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stripes URL binding

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this does not work when i type http://......./app/frontend/show, though if i do http://...../app/frontend/show.action, it's ok. What the problem? Should i change something i web.xml?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most common setup for the StripesDispatcher servlet is to be mapped to *.action URLs. If you want it to be mapped to something else as well, then -yes- you'll need to add that to web.xml.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://greggbolinger.blogspot.com/2008/01/stripes-15-feature-clean-urls.html

Interesting, but i couldn't find anything on web.xml in this article....
I guess we have to declare in web.xml dynamicMappingFilter, but i couldn't find it anywhere in internet....
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it doesn't talk about web.xml, but note that all URLBindings start with "/action/...", while the actual URLs are something like "http://.../app/action/...". So I bet that StripesDispatcher is mapped to "/action/*". After all, if an incoming request isn't mapped to a servlet, then there's nothing the servlet can do about it.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't bet, cause you can lose

It does not work. I'm not 100% sure, but that's how i got it to work. When we wanna use binding, we have to replace dispatcher servlet with dynamicMappingFIlter. At least this worken for me. I couldn't obtain result with something like /* in dispatcher servlet.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vadim Vararu wrote:Don't bet, cause you can lose

It does not work. I'm not 100% sure, but that's how i got it to work. When we wanna use binding, we have to replace dispatcher servlet with dynamicMappingFIlter. At least this worken for me. I couldn't obtain result with something like /* in dispatcher servlet.


Yep, all that makes sense. Servlets won't work without a url pattern and they won't work right with /*. That is why DynamicMappingFilter was created. Unless you need to do something special with DispatcherServlet, there is no need to define it if you use DMF (DMF creates a DispatcherServlet for you). I use DMF exclusively now and have no problems. There are also lots of UrlBinding enhancements in Stripes 1.5.1 which was recently released.

To be clear, DispatcherServlet requires something like /action/* or *.action or /bla/*, etc. DMF does not and works without special prefixes or suffixes, just as clean URL's should.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic