W3C home > Mailing lists > Public > uri@w3.org > August 2001

URI API design [was: URI Test Suite]

From: Dan Connolly <connolly@w3.org>
Date: Sun, 12 Aug 2001 09:47:04 -0500
Message-ID: <3B7696E8.7739E809@w3.org>
To: Mark Nottingham <mnot@akamai.com>
CC: Aaron Swartz <aswartz@upclink.com>, uri@w3.org
Mark Nottingham wrote:
> I've started sketching out a class-based URI module to replace the
> function-based urlparse one distributed with Python... don't know how
> much time I'll have to work on it, but if you (or anyone else) is
> interested, we could give it a go.

I've got a few thoughts on URI API design that I haven't managed
to code up. But while we're talking about it...

Developers tend to learn about URIs from APIs, and I'd like
to clarify some things from that perspective.

For example, a URI object shouldn't have any state. Several APIs
bundle URI parsing with network access, putting GET and POST
methods on the same object as getFragID. Bad news.
So I'd prefer a URIOracle class that knows how to parse
URIs; its interface is exposed with static methods. (this
is pretty much the same thing as a python module with functions).

Another opportunity I'd like to exploit is explaining the
difference between when it's OK to peek into which parts of a URI.

At one level, the only methods are:
	URIOracle.getFragID(aURIRef): # returns fragid
	URIOracle.combine(absBaseURI, aURIRef) # returns absolute URIref
	URIOracle.refTo(fromHere, toThere) # URI "subtraction"

	(and maybe some escaping/unescaping methods...
	and maybe something for encoding form arguments...
	gotta think about that).

At this level, you can't peek in enough to tell the difference
between one scheme and another. This level corresponds to
the application and/or presentation objects in TimBL's
diagrams of the web model


Then there's a separate interface for use by code that does
network access; at this level, you can parse the scheme,
the host, the username/password, the path segments, etc.

Anyway... as I say, I haven't worked out the details. I
have a formal specification of these interfaces in progress...


Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Sunday, 12 August 2001 10:47:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:03 UTC