With release 2.2, this is now possible. For instance, assume I have a
URI "/app/user/{id}" that retrieves a user xml representation with an
id {id}. If I change that xml, I may be tempted to change the URI to
something like "/app/user/v2/{id}", but that's changed my uri and has
broken my resource. Instead I can add "application/xml; version=2.0"
as a media type.
I'd still deploy both actions, so users of the previous resource can
still use it, but the newer version can be accessed with the same
resource.
Versions are only one example of using a media type. You could deploy
other actual types (html, images, etc) to the same uri and just change
the media type to access them.
See http://code.google.com/p/fulworx/wiki/V2p2Documentation#URI_Templates
for more information.
T
This is great though for versioning!!
Sent from my iPhone
> --
> You received this message because you are subscribed to the Google
> Groups "fulworx-dev" group.
> To post to this group, send email to fulwo...@googlegroups.com.
> To unsubscribe from this group, send email to fulworx-dev...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/fulworx-dev?hl=en
> .
>
In fact the documentation on the URITemplate does specifically mention
other types (for instance, atom+xml), but I've been mostly vexed with
the versioning and that was the main driver (for me).
T
On Mar 7, 11:13 am, Matt Darling <mdarl...@gmail.com> wrote:
> Might this approach also make accessing a specific return type better.
> Meaning rather than access the uri with .json, you could ask for it
> with the media type application/json.
>
> This is great though for versioning!!
>
> Sent from my iPhone
>
> On Mar 6, 2010, at 14:09, t <teastl...@gmail.com> wrote:
>
> > For a while I've been bothered by how fulwox deals with versioning
> > (or, more to the point, doesn't). Putting a version id in a URI is
> > not restful in the pure sense, and this should be dealt with using
> > media types.
>
> > With release 2.2, this is now possible. For instance, assume I have a
> > URI "/app/user/{id}" that retrieves a user xml representation with an
> > id {id}. If I change that xml, I may be tempted to change the URI to
> > something like "/app/user/v2/{id}", but that's changed my uri and has
> > broken my resource. Instead I can add "application/xml; version=2.0"
> > as a media type.
>
> > I'd still deploy both actions, so users of the previous resource can
> > still use it, but the newer version can be accessed with the same
> > resource.
>
> > Versions are only one example of using a media type. You could deploy
> > other actual types (html, images, etc) to the same uri and just change
> > the media type to access them.
>
> > Seehttp://code.google.com/p/fulworx/wiki/V2p2Documentation#URI_Templates
This lets you specify something like:
@URITemplate(uri = "/resource/{param}", mediaType = "application/json;
version=2.0")
@Accessor("entity", builderClass=JSONRepresentationBuilder.class)
now this resource will always return json. I will look into doing
this automatically based on the mediaType above (will only really work
for xml, json, xsd).
T
I've included some rules around media type conversion:
If you don't specify a media type, all requests will find it.
If you do specify a media type, only matching requests will find it
If your media type is 'application/xml', all requests will find it
(this is a secondary default)
If you have a media type with other information (like a version) and
the type is 'application/xml', all requests will find it if their
other information matches (this allows for json/xsd transforms against
xml)
T
On Mar 7, 11:13 am, Matt Darling <mdarl...@gmail.com> wrote:
> Might this approach also make accessing a specific return type better.
> Meaning rather than access the uri with .json, you could ask for it
> with the media type application/json.
>
> This is great though for versioning!!
>
> Sent from my iPhone
>
> On Mar 6, 2010, at 14:09, t <teastl...@gmail.com> wrote:
>
> > For a while I've been bothered by how fulwox deals with versioning
> > (or, more to the point, doesn't). Putting a version id in a URI is
> > not restful in the pure sense, and this should be dealt with using
> > media types.
>
> > With release 2.2, this is now possible. For instance, assume I have a
> > URI "/app/user/{id}" that retrieves a user xml representation with an
> > id {id}. If I change that xml, I may be tempted to change the URI to
> > something like "/app/user/v2/{id}", but that's changed my uri and has
> > broken my resource. Instead I can add "application/xml; version=2.0"
> > as a media type.
>
> > I'd still deploy both actions, so users of the previous resource can
> > still use it, but the newer version can be accessed with the same
> > resource.
>
> > Versions are only one example of using a media type. You could deploy
> > other actual types (html, images, etc) to the same uri and just change
> > the media type to access them.
>
> > Seehttp://code.google.com/p/fulworx/wiki/V2p2Documentation#URI_Templates