[Registry-dev] Bug in current API?

Glen Daniels glen at wso2.com
Wed Dec 5 19:15:19 PST 2007


Hey folks:

Was chatting with Jonathan about some Registry and UserManager stuff 
(will be writing a few more mails about other topics later), and one 
thing we realized when discussing storing things in the registry is that 
the Java put() API might need to change a bit....

Consider the way APP works for adding items.  We POST to a collection 
URL, and optionally include a "Slug" header which tells the server what 
we'd LIKE the URL of the new resource to be.  The server then replies 
including a Location: header which tells us what the ACTUAL URL of the 
new resource is.  This is a good model because - a) there might be 
something amiss with the suggested URL, such as unacceptable characters, 
or b) there may already be something there.

I think we need to support this idea directly in the Java API, for 
essentially two reasons.  First, we want to make sure that things work 
consistently between the remote registry and a local one.  Second, we 
might have the same kind of "path cleaning" issues to deal with with 
even a local implementation (for instance, you can't put to 
"/myDir/;tags" - that should probably turn into "/myDir/_tags" or 
something so as not to conflict with "our" URLs).

So the Java API might want to change in a couple of possible ways. 
First, we could just update the path of the Resource being passed to 
put() with the new path.  So you'd have to check resource.getPath() to 
see where it actually ended up.  Second, we could have put() return the 
actual result path String.  We could also do both.  In either case we'd 
want to change the name of the "path" argument to "suggestedPath", with 
appropriate JavaDoc.

Thoughts?

--Glen



More information about the Registry-dev mailing list