Re: JSON + REST

2015-08-21 Thread Amol Ghotankar
I was looking for exactly same thing.

Anyone knows how we can reduce the json result coming from Rest plugin with
combination of conventions  JSON plugin?

I understand one answer is create model per action but looks like its a
little too big ask from design perspective.



On Mon, Aug 12, 2013 at 5:05 PM, Felipe Lorenz 
felipe.lor...@idealogic.com.br wrote:

 Hi,

 I'm working on a project using conventions with rest plugin and I am
 looking for a way to restrict the output of the json results. Since the
 Actions class has many attributes, like lists, and so on, would be good if
 I could restrict the output.

 I know that json plugin can do it for me using the param includeParams,
 but the rest plugins already has json result, so I dont want to add another
 plugin.

 Is there a way to limit the json output just using rest plugin with
 annotations?

 Thanks,

 Felipe Lorenz




-- 



*With Best Regards,*

Amol Ghotankar
Technical Lead
M: +91 9960 980 419 http://www.cursivetech.com


RE: JSON + REST

2015-08-21 Thread Martin Gainty


 


 Date: Fri, 21 Aug 2015 19:10:27 +0530
 Subject: Re: JSON + REST
 From: ghotankaru...@gmail.com
 To: user@struts.apache.org
 
 I was looking for exactly same thing.
 
 Anyone knows how we can reduce the json result coming from Rest plugin with
 combination of conventions  JSON plugin?
 
 I understand one answer is create model per action but looks like its a
 little too big ask from design perspective.
 
 
 
 On Mon, Aug 12, 2013 at 5:05 PM, Felipe Lorenz 
 felipe.lor...@idealogic.com.br wrote:
 
  Hi,
 
  I'm working on a project using conventions with rest plugin and I am
  looking for a way to restrict the output of the json results. Since the
  Actions class has many attributes, like lists, and so on, would be good if
  I could restrict the output.
 
  I know that json plugin can do it for me using the param includeParams,
  but the rest plugins already has json result, so I dont want to add another
  plugin.
 
  Is there a way to limit the json output just using rest plugin with
  annotations?

org.apache.commons.httpclient.methods.PostMethod method = new
org.apache.commons.httpclient.methods.PostMethod(org.apache.struts2.rest.example.ParameterUtils.getBaseUrl()+/orders.json);
method.setRequestEntity(new 
org.apache.commons.httpclient.methods.StringRequestEntity({\amount\:33}));
org.apache.commons.httpclient.HttpClient httpClient=new 
org.apache.commons.httpclient.HttpClient().
httpClient.executeMethod(method);
String response = method.getResponseBodyAsString();

//A resposta do filtro
 ?

Obrigado!

  Thanks,
 
  Felipe Lorenz
 
 
 
 
 -- 
 
 
 
 *With Best Regards,*
 
 Amol Ghotankar
 Technical Lead
 M: +91 9960 980 419 http://www.cursivetech.com