You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Cyril <co...@gmail.com> on 2017/01/05 17:48:26 UTC

No JSON depth control with Badgerfish

Hello,
I tried to apply depthProperties on JSONProvider as told in section
"Controlling Large JAXB XML and JSON input payloads" [1], but with
Badgerfish convention:

<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
    <property name="convention" value="badgerfish" />
    <property name="depthProperties">
        <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
            <property name="innerElementCountThreshold" value="2" />
            <property name="innerElementLevelThreshold" value="2" />
        </bean>
     </property>
</bean>

This has *no* effect. Looking at the source code of JSONProvider class [2],
I realized that this is obviously not supported (see lines of code down
below). However, I could not find any mention of this limitation in the doc
[1].

Shall I create an issue or is this not supported by design for some reason?
In any case, it should be mentioned in the documentation.

Regards,
Cyril

[1]
https://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-ControllingLargeJAXBXMLandJSONinputpayloads
[2]
https://github.com/apache/cxf/blob/master/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java#L287

Code from JSONProvider class:

protected XMLStreamReader createReader(Class<?> type, InputStream is,
String enc)
        throws Exception {
        XMLStreamReader reader = null;
        if (BADGER_FISH_CONVENTION.equals(convention)) {
            reader = JSONUtils.createBadgerFishReader(is, enc);
        } else {
            reader = JSONUtils.createStreamReader(is,
                                                  readXsiType,
                                                  namespaceMap,
                                                  namespaceSeparator,
                                                  primitiveArrayKeys,
                                                  getDepthProperties(),
                                                  enc);
        }
        reader = createTransformReaderIfNeeded(reader, is);

        return reader;
    }

Re: No JSON depth control with Badgerfish

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

I believe you need to have ICLA faxed/emailed to Apache and once it has 
been confirmed then we can ask Dan to update the permissions

Sergey
On 15/01/17 22:20, Cyril wrote:
> Hi,
> Thanks for the update. I think this should be mentioned in the
> documentation. Btw, whom should I ask to get *permissions to edit CXF doc
> pages*?
> (My login on Confluence: *cdangerv *)
>
> Regards,
> Cyril
>
> On Thu, Jan 12, 2017 at 7:21 PM, Sergey Beryozkin <sb...@gmail.com>
> wrote:
>
>> Hi
>>
>> BadgerFish is not really supported any longer at the Jettison level,
>> though as I indicated awhile back if the users will create BadgerFish
>> related patches then I will apply.
>> FYI, Jettison was updated to support the Mapped convention and the depth
>> restrictions.
>>
>> Sergey
>>
>>
>> On 05/01/17 17:48, Cyril wrote:
>>
>>> Hello,
>>> I tried to apply depthProperties on JSONProvider as told in section
>>> "Controlling Large JAXB XML and JSON input payloads" [1], but with
>>> Badgerfish convention:
>>>
>>> <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>>     <property name="convention" value="badgerfish" />
>>>     <property name="depthProperties">
>>>         <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
>>>             <property name="innerElementCountThreshold" value="2" />
>>>             <property name="innerElementLevelThreshold" value="2" />
>>>         </bean>
>>>      </property>
>>> </bean>
>>>
>>> This has *no* effect. Looking at the source code of JSONProvider class
>>> [2],
>>> I realized that this is obviously not supported (see lines of code down
>>> below). However, I could not find any mention of this limitation in the
>>> doc
>>> [1].
>>>
>>> Shall I create an issue or is this not supported by design for some
>>> reason?
>>> In any case, it should be mentioned in the documentation.
>>>
>>> Regards,
>>> Cyril
>>>
>>> [1]
>>> https://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RS
>>> DataBindings-ControllingLargeJAXBXMLandJSONinputpayloads
>>> [2]
>>> https://github.com/apache/cxf/blob/master/rt/rs/extensions/p
>>> roviders/src/main/java/org/apache/cxf/jaxrs/provider/json/
>>> JSONProvider.java#L287
>>>
>>> Code from JSONProvider class:
>>>
>>> protected XMLStreamReader createReader(Class<?> type, InputStream is,
>>> String enc)
>>>         throws Exception {
>>>         XMLStreamReader reader = null;
>>>         if (BADGER_FISH_CONVENTION.equals(convention)) {
>>>             reader = JSONUtils.createBadgerFishReader(is, enc);
>>>         } else {
>>>             reader = JSONUtils.createStreamReader(is,
>>>                                                   readXsiType,
>>>                                                   namespaceMap,
>>>                                                   namespaceSeparator,
>>>                                                   primitiveArrayKeys,
>>>                                                   getDepthProperties(),
>>>                                                   enc);
>>>         }
>>>         reader = createTransformReaderIfNeeded(reader, is);
>>>
>>>         return reader;
>>>     }
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>


Re: No JSON depth control with Badgerfish

Posted by Cyril <co...@gmail.com>.
Hi,
Thanks for the update. I think this should be mentioned in the
documentation. Btw, whom should I ask to get *permissions to edit CXF doc
pages*?
(My login on Confluence: *cdangerv *)

Regards,
Cyril

On Thu, Jan 12, 2017 at 7:21 PM, Sergey Beryozkin <sb...@gmail.com>
wrote:

> Hi
>
> BadgerFish is not really supported any longer at the Jettison level,
> though as I indicated awhile back if the users will create BadgerFish
> related patches then I will apply.
> FYI, Jettison was updated to support the Mapped convention and the depth
> restrictions.
>
> Sergey
>
>
> On 05/01/17 17:48, Cyril wrote:
>
>> Hello,
>> I tried to apply depthProperties on JSONProvider as told in section
>> "Controlling Large JAXB XML and JSON input payloads" [1], but with
>> Badgerfish convention:
>>
>> <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>     <property name="convention" value="badgerfish" />
>>     <property name="depthProperties">
>>         <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
>>             <property name="innerElementCountThreshold" value="2" />
>>             <property name="innerElementLevelThreshold" value="2" />
>>         </bean>
>>      </property>
>> </bean>
>>
>> This has *no* effect. Looking at the source code of JSONProvider class
>> [2],
>> I realized that this is obviously not supported (see lines of code down
>> below). However, I could not find any mention of this limitation in the
>> doc
>> [1].
>>
>> Shall I create an issue or is this not supported by design for some
>> reason?
>> In any case, it should be mentioned in the documentation.
>>
>> Regards,
>> Cyril
>>
>> [1]
>> https://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RS
>> DataBindings-ControllingLargeJAXBXMLandJSONinputpayloads
>> [2]
>> https://github.com/apache/cxf/blob/master/rt/rs/extensions/p
>> roviders/src/main/java/org/apache/cxf/jaxrs/provider/json/
>> JSONProvider.java#L287
>>
>> Code from JSONProvider class:
>>
>> protected XMLStreamReader createReader(Class<?> type, InputStream is,
>> String enc)
>>         throws Exception {
>>         XMLStreamReader reader = null;
>>         if (BADGER_FISH_CONVENTION.equals(convention)) {
>>             reader = JSONUtils.createBadgerFishReader(is, enc);
>>         } else {
>>             reader = JSONUtils.createStreamReader(is,
>>                                                   readXsiType,
>>                                                   namespaceMap,
>>                                                   namespaceSeparator,
>>                                                   primitiveArrayKeys,
>>                                                   getDepthProperties(),
>>                                                   enc);
>>         }
>>         reader = createTransformReaderIfNeeded(reader, is);
>>
>>         return reader;
>>     }
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>

Re: No JSON depth control with Badgerfish

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

BadgerFish is not really supported any longer at the Jettison level, 
though as I indicated awhile back if the users will create BadgerFish 
related patches then I will apply.
FYI, Jettison was updated to support the Mapped convention and the depth 
restrictions.

Sergey

On 05/01/17 17:48, Cyril wrote:
> Hello,
> I tried to apply depthProperties on JSONProvider as told in section
> "Controlling Large JAXB XML and JSON input payloads" [1], but with
> Badgerfish convention:
>
> <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>     <property name="convention" value="badgerfish" />
>     <property name="depthProperties">
>         <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
>             <property name="innerElementCountThreshold" value="2" />
>             <property name="innerElementLevelThreshold" value="2" />
>         </bean>
>      </property>
> </bean>
>
> This has *no* effect. Looking at the source code of JSONProvider class [2],
> I realized that this is obviously not supported (see lines of code down
> below). However, I could not find any mention of this limitation in the doc
> [1].
>
> Shall I create an issue or is this not supported by design for some reason?
> In any case, it should be mentioned in the documentation.
>
> Regards,
> Cyril
>
> [1]
> https://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-ControllingLargeJAXBXMLandJSONinputpayloads
> [2]
> https://github.com/apache/cxf/blob/master/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java#L287
>
> Code from JSONProvider class:
>
> protected XMLStreamReader createReader(Class<?> type, InputStream is,
> String enc)
>         throws Exception {
>         XMLStreamReader reader = null;
>         if (BADGER_FISH_CONVENTION.equals(convention)) {
>             reader = JSONUtils.createBadgerFishReader(is, enc);
>         } else {
>             reader = JSONUtils.createStreamReader(is,
>                                                   readXsiType,
>                                                   namespaceMap,
>                                                   namespaceSeparator,
>                                                   primitiveArrayKeys,
>                                                   getDepthProperties(),
>                                                   enc);
>         }
>         reader = createTransformReaderIfNeeded(reader, is);
>
>         return reader;
>     }
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/