users@jersey.java.net

Re: [Jersey] struts to jersey app

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Sat, 6 Jun 2009 15:07:52 -0700

Yup, I was about to say it really is apples to oranges -- so I'm not
sure if such conversion even makes sense. Depends on case, as usual,
just more so. :)

-+ Tatu +-

On Sat, Jun 6, 2009 at 11:26 AM, Craig
McClanahan<Craig.McClanahan_at_sun.com> wrote:
> paksegu wrote:
>
> Hi,
> Is it difficult to convert a struts app to jersey?
>
> Ransford Segu-Baffoe
>
> paksegu_at_yahoo.com
>
> http://www.noqmx.com/
> https://serenade.dev.java.net/
>
> Trying this is going to be quite a challenge, depending on exactly how you
> are using Struts.  There will be lots of "intermediate" sized issues to
> address, including:
>
> * No direct support for forms the way ActionForm works
>   (although you can get around that in many cases by
>   processing form parameters by name in your resource classes).
>
> * No custom tag library if you're using JSP pages
>   (although things like JSTL can get you a ways
>   towards this)
>
> But the biggest challenge is that a Struts application is "action oriented"
> (even down to the class names of the framework's main APIs :-), not
> "resource oriented".  So, the URIs of a Struts app tend to be verbs
> (/listCustomers.do, /addOrder.do, etc.), not nouns like you would see in a
> typical REST based app (/customers, /customers/123456,
> /customers/123456/orders, etc.).
>
> If you did a really good job of segregating your business logic into support
> classes, your best bet would be to build up a new set of JAX-RS resource
> classes from scratch, reflecting a REST style set of URIs, with the resource
> methods accepting form parameters directly instead of using form beans.
> You've still got to deal with how to build the UI, though.
>
> If your business logic is deeply intermixed in your Struts action classes,
> though (alas, quite a few Struts developers made this mistake), you are
> better off thinking of this as a rewrite, not a conversion.
>
> Craig
>
>