Hello.
Interesting subject. I am working on GIS services, and there have been
some good discussion lately around RESTful feature services.
Some ideas:
* Fetching a single entity could be done without query parameters.
Ala. http://localhost/myapp/cayennexml/entity/Person/1 for person with
id 1.
* Updating a person object could be done by POST to the same url.
* Creating a person object could be done by PUT to something like
http://localhost/myapp/cayennexml/entity/Person/
* Perhaps query for a single entity could be done in the entities
namespace? ala http://localhost/myapp/cayennexml/entity/Person?q=mypersonquery&name=Tore
Hope I am not disturbing.
Regards,
- Tore.
On Apr 15, 2008, at 18:31, [EMAIL PROTECTED] wrote:
Page Edited : CAY : RESTful Cayenne XML Service
RESTful Cayenne XML Service has been edited by Andrus Adamchik (Apr
15, 2008).
(View changes)
Content:
The idea is to build a service that generates XML for persistent
data based on some criteria, passed as a URL with parameters. The
service would use Cayenne to run the queries and XML generation
process would leverage DataMap information as much as possible. The
service should allow arbitrary customization of the generated XML
format. The service should allow to run user code at all points of
the request lifecycle, e.g. to implement security, filter the
results, customize XML, etc. At the same time, the service should be
usable out of the box with no other configuration except for the
"cayenne.xml" and friends.
Addressing The Queries
The service is RESTful in that each request is uniquely identified
by the URL parameters. E.g.:
http://localhost/myapp/cayennexml?q=myquery&p1=a&p2=b
"q" is a reserved parameter corresponding to the mapped query name.
Other parameters are treated as named parameters that should be
passed to the query. (TODO: type conversion)
XML Serialization
Default XML format will be auto-generated from Cayenne mapping and
can be overridden by the user (e.g. certain tags can be renamed,
excluded, etc.). Cayenne DataObject-to-XML generator will be used,
and users would optionally specify a config file overriding the
defaults for XML generation.
Including Relationships in XML
Service callers can not specify which relationships to include, as
this would result in a security hole. Instead the default behavior
is to look at the query prefetches to see what parts of object graph
should be included in the output XML. (TODO: in the future we may
allow specifying included relationships separately from the query
prefetches).
Interceptors
The service would allow registering a chain of interceptors that
would allow implementing custom processing logic at all points of
the invocation lifecycle. E.g.:
public interface XMLServiceInterceptor {
void onRequest(XMLServiceChain chain, XMLEncoder out, ObjectContext
context, String queryName, Map<String, String> parameters);
}
Other Features
• Pagination. I.e. the ability to encode page size and page # in
the URL
Powered by Atlassian Confluence (Version: 2.2.9 Build:#527 Sep 07,
2006) - Bug/feature request
Unsubscribe or edit your notifications preferences