Print

Print


Tim Hodson wrote:

> In terms of versioning and user readability (you never know someone
> may want to bookmark a url :) ), you could perhaps try a url that
> looked something like this using two examples above:
>
> http://dewey.library.nd.edu/mylibrary/ws/v1/facets/


How do I get Apache to execute a CGI script in the middle of a URL?

I have been reading RESTful Web Services in an effort to learn how to
create a "good" Web Services interface to MyLibrary. Similar to the
URL above, it advocates against (simple/traditional) name/value pairs
specified in a GET request. Instead it advocates for the fuller use
of HTTP methods such as GET, HEAD, POST, PUT, DELETE, TRACE, and
OPTIONS in combination with path_info data used for input. In such an
environment an HTTP GET request would retrieve data. PUT might create
data. POST might edit data. DELETE would... delete data. Etc. I can
live with this even though it is not the way I would have done it on
my own.

Thus, one of my URL's might look like this:

   http://example.edu/mylibrary/resource

Sent as a GET request, the response would be an XML (or JSON) stream
of data listing resource names or IDs . The following URL, sent as a
PUT request might create a resource:

   http://example.edu/mylibrary/resource/Wikipedia

All of this is fine and dandy. Writing a CGI script (server
application) that looks at the HTTP method and parses the path_info (/
resource/Wikipedia) and branches accordingly is rather trivial.

My problem is getting Apache to know that /resource/Wikipedia is
intended to be input for the script named mylibrary. When I pass
something like the URL directly above to my script Apache comes back
and says, "File not found" because it is looking for a directory/file
named Wikipedia. How do I get Apache to execute the script named
mylibrary? I could specify the URL like the following, but it is ugly:

   http://example.edu/mylibrary/index.cgi/resource/Wikipedia

What am I doing wrong? How do I need to configure Apache accordingly?

--
Eric Lease Morgan
University Libraries of Notre Dame