You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Gainty <mg...@hotmail.com> on 2011/03/09 18:52:56 UTC

(O/T) RE: Struts 2.0.11.1 question

MG>(hopefully) quick replies

> I wouldn't have a problem with using the GSON project, it's another
> community maintained, battle tested project.  From your examples it should
> probably have a Struts Result object wrapped around it to make it easier to
> use, but that's beside the point.
> 
> <horse level="high" status="on">
> 
> My problem is companies that are short sighted enough to think that spending
> developers time to produce libraries of code that are not directly related
> to their core business (like a medical or insurance company building a JSON
> library) is going to be a good thing for their bottom line.  It's not!  It's
> going to add development and maintenance tasks to their projects that take
> away from developing new and better features that would enhance their core
> business proposition.

MG>as an example:
MG>if client <--> Action class need to communicate using a JSON format 
MG>and some money person sends a directive such as "we dont support JSON" so what alternatives should be considered?
MG>JSON->ConvertToXML->   ~Cloud~  -> ConvertFromXML->JSON
MG>how much (wasted) time would it take to write the converters? ...2 weeks ..or 3..or more?
MG>ok maybe 1 week but then I'll throw in a new XSD..taking the supposed shortcut is oftentimes *longer* than the right solution
MG>then again a true software engineer would  research and champion the best long-term solution (over political expediency)
MG>and implement the best solution on his time with his own equipment (aka eating your own dogfood)
> 
> As developers, when we are presented with a new projects we need to separate
> the core business aspects of the project from the purely technological
> aspects.  We then need to do a little research to find the best fitting,
> most mature tool to accomplish the technical goals and champion that as the
> way to spend more time on the business differentiating goals of the project.
>  Once they see they can get more features in less time for less money,
> they'll come around.
> 
> </horse type="dead" reason="kicked">
MG>allow the powers that be to prioritise tasks but when political roadblocks are tossed in the way..explain the (technical) consequences
MG>opinions from others?
> 
> On Wed, Mar 9, 2011 at 8:34 AM, Paul Zepernick <
> pzepernick@commercebenefitsgroup.com> wrote:
> 
> >  We are using the Google Gson project to handle converting our objects /
> > maps to json.  I will have to take a look at the plugin, I was not even
> > aware of its existence.
> >
> > http://code.google.com/p/google-gson/
> >
> > We put the result from Gson into an InputStream and send it back out using
> > the stream result
> >
> >          <result name="success" type="stream">
> >                          <param name="contentType">application/json</param>
> >                          <param name="inputName">jsonStream</param>
> >                          <param name="bufferSize">1024</param>
> >                 </result>
> >
> > Here is the line from our action that is setting up the InputStream from
> > Gson.
> >
> > setJsonStream(new ByteArrayInputStream(new
> > Gson().toJson(jsonResult).getBytes()));
> >
> >
> > jsonResult is a Map, but could be any object or list of Objects.
> >
> > Paul
> >
> >
> > -----Original Message-----
> > From: Harsh C [mailto:hchaudh1@gmail.com <hc...@gmail.com>]
> > Sent: Wednesday, March 09, 2011 7:24 AM
> > To: Struts Users Mailing List
> > Subject: Re: Struts 2.0.11.1 question
> >
> > Thanks for the responses all. "Not blessed" just means that it is not in
> > the
> > list of s/w that we are allowed to work with.
> >
> > I ended up writing just a plain servlet for now to serve the JSON string
> > which works well enough, except the JSON parsing part of course.
> >
> > HC
> >
> >
> > On Mar 9, 2011 1:19 AM, "Maurizio Cucchiara" <maurizio.cucchiara@gmail.com
> > >
> > wrote:
> > > What do you mean by "not blessed"?
> > >
> > > Maurizio Cucchiara
> > >
> > > Il giorno 09/mar/2011 00.24, "Harsh C" <hc...@gmail.com> ha scritto:
> > > Hi,
> > >
> > > I don't know if this is the right list for a question regarding 2.0.11.1,
> > if
> > > not please let me know the right forum.
> > >
> > > I am trying to use Struts 2.0.11.1 to work on an AJAX-ified app using
> > Dojo.
> > > Problem is, struts-json plugin is not blessed.
> > >
> > > Is there a way in which I can code an Action which returns a JSON string
> > > without using the JSON plugin?
> > >
> > > --
> > > *Thanks,
> > > Harsh*
> >
> > *The information contained in this transmission contains
> > confidential information that is legally privileged. This information is
> > intended only for the use of the individual or entity named above. The
> > authorized recipient of this information is prohibited from disclosing this
> > information to any other party unless required to do so by law or regulation
> > and is required to destroy the information after its stated need has been
> > fulfilled.*
> >
> > *If you are not the intended recipient, you are hereby notified that any
> > disclosure, copying, distribution, or action taken in reliance on the
> > contents of these documents is strictly prohibited. If you have received
> > this information in error, please notify the sender immediately by return
> > email and arrange for the return or destruction of these documents.*
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >