You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Lars-Fredrik Smedberg <it...@gmail.com> on 2014/01/23 13:36:28 UTC

Re: Configuration for application/hal+json

Hi again

Is there anyone that can help out on how to achieve the mediatype and
processing described below?


On Fri, Dec 20, 2013 at 11:00 AM, Lars-Fredrik Smedberg
<it...@gmail.com>wrote:

> To be more specific I'm looking for a way to treat all REST responses with
> vendor specific mediatypes "application/*+json" where * could be e.g. hal
> (application/hal+json) in the same way as "application/json" is treated out
> of the box...
>
> Is there any (easy) way of doing this?
>
> Regards
> Lars-Fredrik
>
>
> On Wed, Dec 18, 2013 at 3:26 PM, Lars-Fredrik Smedberg <itsmeden@gmail.com
> > wrote:
>
>> Hi!
>>
>> I want to be able to return a JSON structure that follows the Hypertext
>> Application, HAL. The media type should then be: application/hal+json
>>
>> When I tried to mark the resource method with:
>>
>> @Produces("application/hal+json")
>>
>> I got the following error when calling the resource:
>>
>> [ERROR   ] The system could not find a javax.ws.rs.ext.MessageBodyWriter
>> or a DataSourceProvider class for the <our model class type> type and
>> application/hal+json mediaType.  Ensure that a
>> javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the
>> type and media type specified.
>>
>> I would like to use the exact same MessageBodyWriter that is configured
>> for application/json.
>>
>> How can i configure this to work as described above?
>>
>> Regards
>> Lars-Fredrik
>>
>>
>> --
>> Med vänlig hälsning / Best regards
>>
>> Lars-Fredrik Smedberg
>>
>> STATEMENT OF CONFIDENTIALITY:
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of the
>> address(es) and may contain confidential or privileged information. If
>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> immediately at itsmeden@gmail.com, and destroy all copies of this
>> message and any attachments.
>>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Configuration for application/hal+json

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
Hi

If I understand the test case correctly it should work as you describe...
however when I change my resource method
to @Produces({"application/hal+json"}) I get the following error:

[ERROR   ] The system could not find a javax.ws.rs.ext.MessageBodyWriter or
a DataSourceProvider class for the test.TestModel type and
application/hal+json mediaType.  Ensure that a
javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the
type and media type specified.

Any suggestions?

Regards
Fredrik


On Mon, Jan 27, 2014 at 7:40 AM, Luciano Resende <lu...@gmail.com>wrote:

> I haven't played with this to see if it actually solves the scenario you
> describe, but the ProvidersRegistryTest test seems to be doing it, and when application/hal+json
> is provided without a specific writer for that, it defaults to
> application/json..
>
> Please take a look and let me know if that is what you are looking for.
>
>
> On Thu, Jan 23, 2014 at 4:36 AM, Lars-Fredrik Smedberg <itsmeden@gmail.com
> > wrote:
>
>> Hi again
>>
>> Is there anyone that can help out on how to achieve the mediatype and
>> processing described below?
>>
>>
>> On Fri, Dec 20, 2013 at 11:00 AM, Lars-Fredrik Smedberg <
>> itsmeden@gmail.com> wrote:
>>
>>> To be more specific I'm looking for a way to treat all REST responses
>>> with vendor specific mediatypes "application/*+json" where * could be e.g.
>>> hal (application/hal+json) in the same way as "application/json" is treated
>>> out of the box...
>>>
>>> Is there any (easy) way of doing this?
>>>
>>> Regards
>>> Lars-Fredrik
>>>
>>>
>>> On Wed, Dec 18, 2013 at 3:26 PM, Lars-Fredrik Smedberg <
>>> itsmeden@gmail.com> wrote:
>>>
>>>> Hi!
>>>>
>>>> I want to be able to return a JSON structure that follows the Hypertext
>>>> Application, HAL. The media type should then be: application/hal+json
>>>>
>>>> When I tried to mark the resource method with:
>>>>
>>>> @Produces("application/hal+json")
>>>>
>>>> I got the following error when calling the resource:
>>>>
>>>> [ERROR   ] The system could not find a
>>>> javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the
>>>> <our model class type> type and application/hal+json mediaType.  Ensure
>>>> that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application
>>>> for the type and media type specified.
>>>>
>>>> I would like to use the exact same MessageBodyWriter that is configured
>>>> for application/json.
>>>>
>>>> How can i configure this to work as described above?
>>>>
>>>> Regards
>>>> Lars-Fredrik
>>>>
>>>>
>>>> --
>>>> Med vänlig hälsning / Best regards
>>>>
>>>> Lars-Fredrik Smedberg
>>>>
>>>> STATEMENT OF CONFIDENTIALITY:
>>>> The information contained in this electronic message and any
>>>> attachments to this message are intended for the exclusive use of the
>>>> address(es) and may contain confidential or privileged information. If
>>>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>>>> immediately at itsmeden@gmail.com, and destroy all copies of this
>>>> message and any attachments.
>>>>
>>>
>>>
>>>
>>> --
>>> Med vänlig hälsning / Best regards
>>>
>>> Lars-Fredrik Smedberg
>>>
>>> STATEMENT OF CONFIDENTIALITY:
>>> The information contained in this electronic message and any
>>> attachments to this message are intended for the exclusive use of the
>>> address(es) and may contain confidential or privileged information. If
>>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>>> immediately at itsmeden@gmail.com, and destroy all copies of this
>>> message and any attachments.
>>>
>>
>>
>>
>> --
>> Med vänlig hälsning / Best regards
>>
>> Lars-Fredrik Smedberg
>>
>> STATEMENT OF CONFIDENTIALITY:
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of the
>> address(es) and may contain confidential or privileged information. If
>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> immediately at itsmeden@gmail.com, and destroy all copies of this
>> message and any attachments.
>>
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Configuration for application/hal+json

Posted by Luciano Resende <lu...@gmail.com>.
I haven't played with this to see if it actually solves the scenario you
describe, but the ProvidersRegistryTest test seems to be doing it, and
when application/hal+json
is provided without a specific writer for that, it defaults to
application/json..

Please take a look and let me know if that is what you are looking for.


On Thu, Jan 23, 2014 at 4:36 AM, Lars-Fredrik Smedberg
<it...@gmail.com>wrote:

> Hi again
>
> Is there anyone that can help out on how to achieve the mediatype and
> processing described below?
>
>
> On Fri, Dec 20, 2013 at 11:00 AM, Lars-Fredrik Smedberg <
> itsmeden@gmail.com> wrote:
>
>> To be more specific I'm looking for a way to treat all REST responses
>> with vendor specific mediatypes "application/*+json" where * could be e.g.
>> hal (application/hal+json) in the same way as "application/json" is treated
>> out of the box...
>>
>> Is there any (easy) way of doing this?
>>
>> Regards
>> Lars-Fredrik
>>
>>
>> On Wed, Dec 18, 2013 at 3:26 PM, Lars-Fredrik Smedberg <
>> itsmeden@gmail.com> wrote:
>>
>>> Hi!
>>>
>>> I want to be able to return a JSON structure that follows the Hypertext
>>> Application, HAL. The media type should then be: application/hal+json
>>>
>>> When I tried to mark the resource method with:
>>>
>>> @Produces("application/hal+json")
>>>
>>> I got the following error when calling the resource:
>>>
>>> [ERROR   ] The system could not find a javax.ws.rs.ext.MessageBodyWriter
>>> or a DataSourceProvider class for the <our model class type> type and
>>> application/hal+json mediaType.  Ensure that a
>>> javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the
>>> type and media type specified.
>>>
>>> I would like to use the exact same MessageBodyWriter that is configured
>>> for application/json.
>>>
>>> How can i configure this to work as described above?
>>>
>>> Regards
>>> Lars-Fredrik
>>>
>>>
>>> --
>>> Med vänlig hälsning / Best regards
>>>
>>> Lars-Fredrik Smedberg
>>>
>>> STATEMENT OF CONFIDENTIALITY:
>>> The information contained in this electronic message and any
>>> attachments to this message are intended for the exclusive use of the
>>> address(es) and may contain confidential or privileged information. If
>>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>>> immediately at itsmeden@gmail.com, and destroy all copies of this
>>> message and any attachments.
>>>
>>
>>
>>
>> --
>> Med vänlig hälsning / Best regards
>>
>> Lars-Fredrik Smedberg
>>
>> STATEMENT OF CONFIDENTIALITY:
>> The information contained in this electronic message and any
>> attachments to this message are intended for the exclusive use of the
>> address(es) and may contain confidential or privileged information. If
>> you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> immediately at itsmeden@gmail.com, and destroy all copies of this
>> message and any attachments.
>>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/