Hi all, This sounds like a very useful idea. What about adding a new org.restlet.util.ReferenceBuilder class?
It could have methods starting with "append" like the StringBuilder class, and follow the Reference naming convention. For example it could have: - appendScheme(String scheme) - appendSchemeSpecificPart(String ssp) - appendFragment(String fragment) - appendHierarchicalPart(String ssp) - appendAuthority(String authority) - appendPath(String path) - appendSegment(String segment) - appendMatrixParam(String name, String value) - appendQuery(String query) - appendQueryParam(String name, String value) - toReference() - toURI() - toString() The separator would be automatically added when a change of part would be detected or anticipated, such as the ":" after the scheme. It should force the reference to be built in the correct order so an efficient StringBuilder could be used internally and should guide the developer with clear warning messages when parts are not appended in the right order. Best regards, Jerome > -----Message d'origine----- > De : Rob Heittman [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 29 novembre 2007 21:26 > À : [email protected] > Objet : Re: Lightweight alternative to Reference > > > To me, the Reference class actually seems quite lightweight > and efficient for the amount of usefulness and flexibility it > provides to consumers and mutators of the Reference. I > understand the idea of having nice syntax for building up a > Reference. What if there was something independent, like a > URIBuilder class, that supplied such syntax and could emit a > String, java.net.URI, or Reference? > > ----- Original Message ----- > From: "Kevin Conaway" <[EMAIL PROTECTED]> > To: [email protected] > Sent: Thursday, November 29, 2007 3:06:57 PM (GMT-0500) > America/New_York > Subject: Re: Lightweight alternative to Reference > > Hi Mike, > > The problem with java.net.URI is that you must specify the > URI parts at construction time. There are no setters and no > way to nicely build a URI piecemeal. That leads to string > concatenation and other ugliness > > Kevin > > > On Nov 29, 2007 2:43 PM, Mike Brzozowski < > [EMAIL PROTECTED] > wrote: > > > > Kevin Conaway <kevin.conaway <at> gmail.com > writes: > > Would it be possible add a new class called URI to > facilitate building URIs to > use in client calls? It can be cumbersome to either build the > uri as a string > by hand or use the heavy Reference class.I suggest adding a > lightweight class > called URI that allows users to easily build URIs like the following: > > Check out the URI class introduced in JDK 1.4... it might do > much of what you're > looking for: > > http://java.sun.com/javase/6/docs/api/java/net/URI.html > > --Mike > >

