Hi,

Just short append to the original Anthony's question:
Alternative to put the version inside the path is registering custom media 
type, like
application/raylight.v1+json
application/raylight.v2+json

and customize JSONProvider for these types accordingly.

The advantage of this option is that server and clients can use single URL for 
old and new versions of JSON payload.

Regards,
Andrei.

> -----Original Message-----
> From: Sergey Beryozkin [mailto:[email protected]]
> Sent: Donnerstag, 21. April 2016 10:48
> To: MULLER, Anthony
> Cc: [email protected]
> Subject: Re: [CXF] 2.7.16 Output customisation
> 
> Hi Anthony
> 
> CC-ing to the users as it can be of interest.
> 
> As far as CXF is concerned, it can be achieved with JSONProvider, using an
> 'outTransformElements' or 'outAppendElements.
> 
> If you use Jackson then I',m not sure if it is possible.
> 
> Finally, perhaps you can consider building JSON manually, without depending
> on JAX-RS to serialize the data, and return it as String.
> 
> HTH, Sergey
> 
> On 20/04/16 16:08, MULLER, Anthony wrote:
> > Hello Sergey,
> >
> > Another quick question :)
> >
> > I'm wondering how we could offer a new JSON output without killing our
> > existing customers :)
> >
> > For example, we have currently a call like /raylight/v1/about
> > Returning a JSON output like : {"about": { "v" : 1 }}
> >
> > I'd like to add another JSON output for new customers without removing
> "legacy" one:
> > /raylight/v2/about
> > Returning a JSON output like : {"about": { "version" : 2 }}
> >
> > As you can see, my idea is to play with the version in the path to be able 
> > to
> route the request and use internally the correct JSONProvider...
> >
> > Is it a good approach? How it could be implemented?
> >
> > Best regards,
> > Anthony

Reply via email to