2

Its best to just show what I'm trying to achieve. This isn't meant to be functional, just describe the problem.

Here's what my tomcat web app currently accepts...

  /.../mywebapp/doSomething.jsp?id=somenumber.

I want it to look like

  /.../mywebapp/somenumber

What is this concept called, and does anyone have a good resource on it ? I'd like to use pure java as much as possible, and avoid the use of apache-specific or 3rd party resources.

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
JHarnach
  • 3,944
  • 7
  • 43
  • 48
  • This is called servlet mapping you might look here: http://stackoverflow.com/questions/234210/can-anyone-explain-servlet-mapping – Romain Hippeau Oct 21 '10 at 22:41

2 Answers2

2

This is URL rewriting and if you don't want to implement it using mod_rewrite (and Apache HTTPD), then you could use Tuckey's UrlRewriteFilter, a Java Web Filter based on mod_rewrite.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Hmm... which do you recommend ? Or, which is more common in real-world applications ? – JHarnach Oct 22 '10 at 15:14
  • @JHarnach Apache + mod\_rewrite is IMO the most efficient architecture (and will save some CPU cycles at the app server level) but also a bit more complex. If you don't have a dedicated box for Apache, if you don't want to use Apache, then Tuckey's filter is the way to go. – Pascal Thivent Oct 22 '10 at 15:23
0

have you look at Codeigniter.net? it's php framework. it url style is just like what you want. What did CI use anyway?

swdev
  • 4,997
  • 8
  • 64
  • 106