There are some implementation of mod_rewrite for Java.
I personally use UrlRewriteFilter, which "is a Java Web Filter
for any J2EE compliant web application server (such as Resin,
Orion or Tomcat), which allows you to rewrite URLs before
they get to your code."
All what you should do is adding a jar and editing an xml file.
In your example the snippet would be like this:
<rule>
<from>/record/([^\/]+)$</from>
<to>/record?id=$1</to>
</rule>
You can finde more info in this site:
http://tuckey.org/urlrewrite/
Kiraly Peter
http://extensiblecatalog.info
----- Original Message -----
From: "Robert Forkel" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Thursday, July 03, 2008 8:42 AM
Subject: Re: [CODE4LIB] implementing cool uris in java
> if i understood correctly, you already create urls like
> http://catalog.lib.ncsu.edu/record?id=1234565.
> since cool urls are the ones that don't change, you will still have
> to support these. so i'd think an easy way to support the even cooler
> http://catalog.lib.ncsu.edu/record/123456 would be to use something
> like apache's mod_rewrite
> (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html) assuming you
> use apache in front of whatever serves your java code.
> regards,
> robert
>
> On Thu, Jul 3, 2008 at 6:22 AM, Emily Lynema <[log in to unmask]>
> 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
>>
>> -emily
>> --
>> Emily Lynema
>> Systems Librarian for Digital Projects
>> Information Technology, NCSU Libraries
>> 919-513-8031
>> [log in to unmask]
>>
>
|