You know I agree. When I first saw the getEntityAsObject() I assumed it converted the object for me. I didn't really think it was something so complex that I'd have to create a converter. But I obviously didn't make the connection with the ObjectRepresentation. I just followed the docs and source to Message, then Application, where I didn't see how to use the converter with a client request. I've really just started using this a couple days ago, and most of my time has been reading, asking questions, and a little coding. It does seem there is a lack of documentation. Is there more some where? I think I've read most everything. A couple points I would like more documentation on is client side coding, and client security. Which I'll probably post about the security part soon.

Rob Heittman wrote:

To my mind, what's misleading about the current setup is the inconsistent semantics. Other flavors of getEntityAsXXX return XXXRepresentation:

  DomRepresentation getEntityAsDom()
  SaxRepresentation getEntityAsSax()

By association, developers may intuit that getEntityAsObject should automatically return ObjectRepresentation, when in fact it returns null unless the entity is associated with an Application (e.g. is an incoming request routed through an Application) and the developer has set up a custom Converter attached to the Application. One might observe that given the Javadoc and the fact that it returns Object and not ObjectRepresentation, this difference should be obvious, but the discussion here proves it's not.

I'd seriously propose something like this; although it breaks API compatibility, I think it's the right thing to do for semantic consistency.

ObjectRepresentation getEntityAsObject() -- works like getEntityAsDom() and getEntityAsSax() Object getConvertedEntity() -- works like the current getEntityAsObject()

I hope that although Restlet has reached a 1.0 release, the API won't be prematurely ossified ... as more developers work with the code in real life, some points of confusion like this will need to get addressed in ways that aren't reverse compatible.


----- Original Message -----
From: "Stanczak Group" <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, August 23, 2007 9:11:44 AM (GMT-0500) America/New_York
Subject: Re: getEntityAsObject()?

This works, thanks. I still don't understand why getEntityAsObject() is
even there.


--
Justin Stanczak
Stanczak Group
812-735-3600

"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke

Reply via email to