You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Amol Ghotankar <gh...@gmail.com> on 2015/08/21 15:40:27 UTC

Re: JSON + REST

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.lorenz@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

Posted by Martin Gainty <mg...@hotmail.com>.
                                                                                                 


> Date: Fri, 21 Aug 2015 19:10:27 +0530
> Subject: Re: JSON + REST
> From: ghotankarua50@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.lorenz@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>