We did this feature awhile back; sometimes people would like to use say a default JSON provider to support a custom media type not supported by the statically annotated default provider, so that it was a way to get the default providers extended to support other media types...

Cheers, Sergey
On 06/05/15 16:22, Romain Manni-Bucau wrote:
ok I see, thks!


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-06 17:20 GMT+02:00 Sergey Beryozkin <[email protected]>:

If you set the custom property I've referred to then the runtime will
prefer that to a static Consumes/Produces. It is a CXF specific feature

Sergey
On 06/05/15 16:15, Romain Manni-Bucau wrote:

how

https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=blob;f=rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java;h=31721b0cea8be76318ce350ab047ff034aba1808;hb=c7db05bc509942f266c494c692d8331f8fdf8ada
could accept */*?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-06 17:07 GMT+02:00 Sergey Beryozkin <[email protected]>:

  I think it is fine now, have a look at the source please...

Thanks, Sergey
On 06/05/15 16:00, Romain Manni-Bucau wrote:

  Hmm, doesn't
org.apache.cxf.jaxrs.provider.PrimitiveTextProvider#isReadable/
isWriteable ignore parent configuration?


Romain Manni-Bucau

@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-06 16:56 GMT+02:00 Sergey Beryozkin <[email protected]>:

   Hi,

On 06/05/15 10:19, Romain Manni-Bucau wrote:

   2015-05-06 11:13 GMT+02:00 Sergey Beryozkin <[email protected]>:


    Sure, having it configurable would be one option, will take care of
it.

  Another option is to register a custom provider.


   yes this is more or less the same since you redefine the priitive

provider
but would be sad to have to impl this one yourself as a user ;)

   I've just realized this provider is already configurable
indirectly, it

has consumeMediaTypes and produceMediaTypes properties, setting both to
*/*
will do it.

FYI, I've just updated PrimitiveTextProvider to support
Boolean/boolean,
etc only but not String. I had to do it in order to annotate
PrimitiveTextProvider with text/plain (to start getting CXF-6307
addressed), but String has to be supported for */* by default.

Thanks, Sergey



     Thanks, Sergey






On 06/05/15 09:59, Romain Manni-Bucau wrote:

    I see,


maybe something doesn't hurting much CXF would be to add a flag in
the
primitive provider. This way users could at least configure it to go
back
to the previous behavior.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-06 10:54 GMT+02:00 Sergey Beryozkin <[email protected]>:

     Hi Romain


  Looks like you have a very nice set of tests which is impressive
:-)

That was a 'side-effect' of getting a spec requirement enforced. It
is
about  section 4.2.6,
"java.lang.Boolean , java.lang.Character , java.lang.Number Only
for
text/plain"

Personally I think it is too restrictive but a TCK test is failing
against
CXF right now, which is partially related to this requirement,
hence
this
restriction needs to be enforced first for the final test solution
to
be
done.
Now that it is done it would be sensitive still continue to support
Boolean/etc for any media type by default - we've had some troubles
with
the matching algorithm offering a more flexible sub-resource
selection
in
some of the edge cases by default earlier...

Thanks, Sergey


On 06/05/15 09:23, Romain Manni-Bucau wrote:

     Hi guys,


  org.apache.cxf.jaxrs.provider.PrimitiveTextProvider#isSupported
changed
when upgrading to also validate the media type.

This sounds better but it is actually a regression since before it
was
supported with any media type.

A solution could be to have it twice in the writer chain, once
with
this
restriction at the beginning and another time without this
restriction
at
the end as a fallback.

Not sure it does worth a fix but was a small side effect I
experienced
upgrading.

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <
https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

















Reply via email to