You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eero Nevalainen <en...@gmail.com> on 2012/12/17 18:25:14 UTC

Webwork -> Struts 2.0.x migration xwork API issue related to ProxyFactories

Hi,

I am working on a somewhat legacy Webwork + Spring + Hibernate
application where we finally decided to bite the bullet and move to
Struts 2.0.14 from Webwork 2.2.7.

>From googling it initially seemed like the migration doesn't require
humongous effort; however there is a certain API change in xwork that
I have not seen mentioned anywhere and that I ran into. Namely, there
is class X extending DefaultActionProxyFactory, and with xwork 2 there
are two issues:

1. ActionProxyFactory is now an interface, not a class. I can't call
"setFactory(this)" in the bind() method.

2. More interestingly, it looks like in the ActionProxyFactory,
"Invocations" and "Proxies" behave differently. We used to have

    @Override
    public ActionInvocation createActionInvocation(ActionProxy actionProxy)

and

    @Override
    public ActionInvocation createActionInvocation(ActionProxy
actionProxy, Map map)

in the subclass, but now the overridable stuff is

    @Override
    public ActionProxy createActionProxy(String namespace, String
actionName, Map extraContext)

I am a bit of a loss as to how to interpret the meaning of these
changes so I could meaningfully start fixing this. Any
insight/pointers as to what the relevance of this to the functioning
of the factory might be, would be greatly appreciated.

On another note, how is the compatibility of the various versions of
the spring-plugin with Spring 3.0.2 and Struts 2.0.14? Webwork worked
fine with the Spring version, but it seems to me that Struts 2.0.x
assumes something like a 2.5.x series Spring framework...


-- 
Eero Nevalainen (enevalainen@gmail.com)

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


Re: Webwork -> Struts 2.0.x migration xwork API issue related to ProxyFactories

Posted by Lukasz Lenart <lu...@apache.org>.
2012/12/17 ChadDavis <ch...@gmail.com>:
> I don't have answers to your specific questions, but I did do a similar
> migration recently.  I encountered one fairly significant hidden issue that
> I'll warn you about.  When you migrate, you can leave your xml on the
> xworks dtds.  It works, but as you migrate up the struts2 versions, there's
> a point where they moved the actual storage of the dtd's ( on the web I
> mean ) to apache.  This causes the internal resolution of the dtd's to
> break.  The simplest way to avoid this is to migrate your xml config files
> to the Struts2 dtds.  Here's a link to my thread on this issue, but you
> don't really need to digest it all.  You can be safe by simply migrating
> the to the struts dtd's from the start.
>
> http://markmail.org/thread/qkc7owqiiu3j63gl

I've upgraded the docs to address that issue
https://cwiki.apache.org/confluence/display/WW/WebWork+2+Migration+Strategies


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Webwork -> Struts 2.0.x migration xwork API issue related to ProxyFactories

Posted by ChadDavis <ch...@gmail.com>.
I don't have answers to your specific questions, but I did do a similar
migration recently.  I encountered one fairly significant hidden issue that
I'll warn you about.  When you migrate, you can leave your xml on the
xworks dtds.  It works, but as you migrate up the struts2 versions, there's
a point where they moved the actual storage of the dtd's ( on the web I
mean ) to apache.  This causes the internal resolution of the dtd's to
break.  The simplest way to avoid this is to migrate your xml config files
to the Struts2 dtds.  Here's a link to my thread on this issue, but you
don't really need to digest it all.  You can be safe by simply migrating
the to the struts dtd's from the start.

http://markmail.org/thread/qkc7owqiiu3j63gl

On Mon, Dec 17, 2012 at 10:25 AM, Eero Nevalainen <en...@gmail.com>wrote:

> 3.0.2

Re: Webwork -> Struts 2.0.x migration xwork API issue related to ProxyFactories

Posted by Lukasz Lenart <lu...@apache.org>.
2012/12/18 Eero Nevalainen <en...@gmail.com>:
> To respond to my own post to record a bit more information about the
> actual problem here, in case someone has any ideas:
>
> What the xwork 1-style ActionProxyFactory does is that it returns an
> ActionInvocation. Our legacy code further extends the
> DefaultActionInvocation in order to get to override createResult --
> and this has something to do with integrating Tiles views with Spring.
>
> In xwork2, the create-method of the factory actually returns an
> ActionProxy. Now, I can certainly create my own proxies to return, but
> now the ActionInvocation is hidden inside the Proxy and is created in
> DefaultActionProxy's prepare() method.
>
> So I guess what the question is -- how does one override
> createResult() or equivalent in the new-style API...

Take a look on RestActionProxyFactory which overrides
DefaultActionProxyFactory, just write your own implementation and used
it as below:

<bean type="com.opensymphony.xwork2.ActionProxyFactory"
name="myActionFactory" class="com.demo.MyActionProxyFactory" />
<constant name="struts.actionProxyFactory" value="myActionFactory" />


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Re: Webwork -> Struts 2.0.x migration xwork API issue related to ProxyFactories

Posted by Eero Nevalainen <en...@gmail.com>.
To respond to my own post to record a bit more information about the
actual problem here, in case someone has any ideas:

What the xwork 1-style ActionProxyFactory does is that it returns an
ActionInvocation. Our legacy code further extends the
DefaultActionInvocation in order to get to override createResult --
and this has something to do with integrating Tiles views with Spring.

In xwork2, the create-method of the factory actually returns an
ActionProxy. Now, I can certainly create my own proxies to return, but
now the ActionInvocation is hidden inside the Proxy and is created in
DefaultActionProxy's prepare() method.

So I guess what the question is -- how does one override
createResult() or equivalent in the new-style API...


2012/12/17 Eero Nevalainen <en...@gmail.com>:
> Hi,
>
> I am working on a somewhat legacy Webwork + Spring + Hibernate
> application where we finally decided to bite the bullet and move to
> Struts 2.0.14 from Webwork 2.2.7.
>
> From googling it initially seemed like the migration doesn't require
> humongous effort; however there is a certain API change in xwork that
> I have not seen mentioned anywhere and that I ran into. Namely, there
> is class X extending DefaultActionProxyFactory, and with xwork 2 there
> are two issues:
>
> 1. ActionProxyFactory is now an interface, not a class. I can't call
> "setFactory(this)" in the bind() method.
>
> 2. More interestingly, it looks like in the ActionProxyFactory,
> "Invocations" and "Proxies" behave differently. We used to have
>
>     @Override
>     public ActionInvocation createActionInvocation(ActionProxy actionProxy)
>
> and
>
>     @Override
>     public ActionInvocation createActionInvocation(ActionProxy
> actionProxy, Map map)
>
> in the subclass, but now the overridable stuff is
>
>     @Override
>     public ActionProxy createActionProxy(String namespace, String
> actionName, Map extraContext)
>
> I am a bit of a loss as to how to interpret the meaning of these
> changes so I could meaningfully start fixing this. Any
> insight/pointers as to what the relevance of this to the functioning
> of the factory might be, would be greatly appreciated.
>
> On another note, how is the compatibility of the various versions of
> the spring-plugin with Spring 3.0.2 and Struts 2.0.14? Webwork worked
> fine with the Spring version, but it seems to me that Struts 2.0.x
> assumes something like a 2.5.x series Spring framework...
>
>
> --
> Eero Nevalainen (enevalainen@gmail.com)



-- 
Eero Nevalainen (enevalainen@gmail.com)

-- "Rahvas on pitkällisen sorron vuoksi kääntynyt vain sisäänpäin - se
saattaa kenties moittia nimismiestä tai pappia, mutta maaherra on
sille jo pieni jumala ja senaattori vailla vertaa." -- Snellman

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