URI API design [was: URI Test Suite]

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

  http://www.w3.org/DesignIssues/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...

  http://www.w3.org/XML/9711theory/URIclient.lsl
  http://www.w3.org/XML/9711theory/URI.lsl


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Sunday, 12 August 2001 10:47:07 UTC