Print

Print


On Thu, 3 Jul 2008, Emily Lynema wrote:

> I'm looking around for tools to implement cool uris in java. I've been 
> studying the restlet framework tonight, and while it sounds cool, I think it 
> would also require a complete re-write of an application that is currently 
> based on the Servlet API. And, of course, I'm working under a time crunch.
>
> Is there anything out there to assist me in working with cool uris besides 
> just using regular expressions when parsing URLs?
>
> For example, I'd like to create URLs like:
>
> http://catalog.lib.ncsu.edu/record/123456
>
> instead of:
>
> http://catalog.lib.ncsu.edu/record?id=1234565

I don't know enough about what you're doing, but you can have one program 
handle both cases .. wherever it's doing it's input validatation, the 
logic is basically:

 	if ( request.getQueryString )
 		parse_query_string()
 	else if ( request.getPathInfo )
 		parse_path_info()
 	else
 		set_defaults()

...

And you don't need regular expressions for processing the PATH_INFO -- as 
it's positional just take the string, and split on '/', and assign them to 
whatever the corresponding named parameter is.

-----
Joe Hourcle