aspose file tools
The moose likes Servlets and the fly likes Tips to write friendly URLs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Tips to write friendly URLs" Watch "Tips to write friendly URLs" New topic
Author

Tips to write friendly URLs

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3359

Hey,
I am trying to write a Friendly URLs by hand:
/servlet/2010/11/27
/servlet/year/2010/month/11/day/27
How to access request parameters this way?
I'm doing it right now via RegExp but is there a better way?
Thanks.
dave hopkins
Greenhorn

Joined: Oct 27, 2006
Posts: 22
There's more to REST than just matching params dude. Forget code just for the minute and read up on the principles first.

Here's a really good article

http://www.peej.co.uk/articles/restfully-delicious.html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56183
    
  13

What you are describing is not RESTful, it's called "friendly URLs".

So what are you really asking? Do you want to create a RESTful web service? Or do you just want to be able to specify parameters in the URL rather than in a query string?

If the latter, you can grab the string using getPathInfo() and parsing it yourself.


P.S. The FrontMan 2 beta does this for you.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3359

Yes, I mean friendly URLs not RESTful, sorry I forgot about that.
Actually that is what I'm doing, parse the string of getPathInfo().
I will correct my post subject.
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56183
    
  13

Can you not just use String.split()?
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3359

Bear Bibeault wrote:Can you not just use String.split()?

Even better
Thanks.
Jagdeep Sharma
Ranch Hand

Joined: May 24, 2010
Posts: 121

John Todd wrote:
Bear Bibeault wrote:Can you not just use String.split()?

Even better
Thanks.


Hey People,

I found myself very new to this topic. Can you people give some difference between RESTful urls and user friendly urls.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56183
    
  13

REST
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Tips to write friendly URLs
 
Similar Threads
FIPS compliant Tomcat using JSSE
SSL and Tomcat problems - ClassNotFoundException: TLS
JForum nice urls (as on Java Ranch)
CMS - Approach to handle requests using directory names
Jax-ws client deploy stucked