[Building Sakai] Writing an EntityProvider
Jim Eng
jimeng at umich.edu
Thu Oct 15 09:47:54 PDT 2009
Hi Aaron,
I hope you (or anyone else who reads this message) can help me with an
issue I'm having in writing an EntityProvider to serve up JSON views
of ContentEntity objects (ContentCollection's and ContentResources's).
On a sakai instance running my laptop, I have a resource with this
resourceId:
/group/d6759b23-39e1-48a3-beb7-fc0cc54cc18a/pothole.jpg
The prefix of the entity provider is "resources-list-item", so the URL
to request this item from the direct servlet is:
http://localhost:8080/direct/resources-list-item/group/d6759b23-39e1-48a3-beb7-fc0cc54cc18a/pothole.jpg.json
When this request arrives at EntityHandlerImpl.handleEntityAccess(),
the path is shown in the debugger as:
/resources-list-item/group/d6759b23-39e1-48a3-beb7-fc0cc54cc18a/
pothole.jpg.json
It appears that EntityHandlerImpl.handleEntityAccess() correctly
identifies the format as "json" and creates an EntityReference object
with prefix of "resources-list-item", but it assigns an entityId of
"group" in the EntityReference. That is the EntityReference passed to
my EntityProvider's getEntity() method. This results in an error and I
do not get any JSON.
Have I done something wrong, or is there a problem upstream from my
code?
I'm also wondering how to deal with entityId's that being and end with
a slash. EntityID's for ContentCollection's and ContentResources's
generally begin with a slash, and have one or more internal slashes.
For ContentCollection's, they end with a slash. I'm wondering how to
create a URL to identify such entityId's to the direct servlet so my
EntityProvider can get the full entityId, including leading and
trailing slashes. Is that possible?
Thanks.
Jim
More information about the sakai-dev
mailing list