struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Lorenz <felipe.lor...@idealogic.com.br>
Subject Re: Rest + JSON
Date Wed, 26 Feb 2014 16:17:35 GMT
Hello Lukasz,

There is any impact if we add the following code in the JsonLibHandler 
class:

JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);

Just right above the line:

if (target != null && sb.length() > 0 && sb.charAt(0) == '[') {

And use it?

I can't see a reason to not use it. Since it is throwing Exception in 
the actual code at same time will not make difference if my object does 
not contain a cyclic reference.

What is your opinion?

Also, it is just a workaround for the cyclic problem. I still want to 
have same control over the results, using ContentTypeHandler, as in the 
json-plugin.

There is a way to read some parameter coming from the request by the 
ContentTypeHandler?

Thanks,
Felipe Lorenz

Em 26/02/2014 10:02, Lukasz Lenart escreveu:
> You can always share your work as a patch or a plugin ;-)
> 
> 2014-02-26 14:00 GMT+01:00 Felipe Lorenz 
> <felipe.lorenz@idealogic.com.br>:
>> Thanks Lukasz, I think I´ll create a CustomContentTypeHandler.
>> 
>> Em 26/02/2014 04:21, Lukasz Lenart escreveu:
>>> 
>>> 2014-02-25 19:08 GMT+01:00 Felipe Lorenz 
>>> <felipe.lorenz@idealogic.com.br>:
>>>> 
>>>> Hi,
>>>> 
>>>> I was not clear with my doubt. I dont´t want to use json-plugin, 
>>>> since
>>>> rest-plugin already has a json solution.
>>>> 
>>>> I wanna try to use 100% of rest-plugin json solution and, at same 
>>>> time,
>>>> keep
>>>> the control over the data is returned.
>>> 
>>> 
>>> I think the only option you have is to write your own
>>> ContentTypeHandler [1] and override built-in JSON handler
>>> 
>>> [1]
>>> 
>>> http://struts.apache.org/release/2.3.x/docs/rest-plugin.html#RESTPlugin-CustomContentTypeHandlers
>>> 
>>> 
>>> Regards
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message