Issue Details (XML | Word | Printable)

Key: APF-1130
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Matt Raible
Reporter: Matt Raible
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
AppFuse

Upgrade to Struts 2.1

Created: 02/Feb/09 11:24 AM   Updated: 09/Jan/10 05:50 PM
Component/s: Web - Struts
Affects Version/s: 2.0.2
Fix Version/s: 2.1.0-M2

File Attachments: 1. Text File struts-2.1-upgrade.patch (16 kB)




Slava Kovalenko added a comment - 22/Apr/09 11:15 AM
To migrate to Struts 2.1 :

1. Follow instructions
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html
just ignore change related to web.xml StrutsPrepareAndExecuteFilter usage - it will not work with Sitemesh as it will strap all attributes

2. Update web.xml with appropriate filters

2.a struts-cleanup filter is not required anymore and 2 struts filter instead of one before
BEFORE 2.1 :
    <filter>
        <filter-name>struts-cleanup</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>
    <filter>
        <filter-name>struts</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
AFTER :
    <filter>
      <filter-name>struts2-prepare</filter-name>
      <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
      <init-param>
        <param-name>actionPackages</param-name>
        <param-value>com.peak6.weseed.webapp.admin.action</param-value>
      </init-param>
    </filter>
    <filter>
      <filter-name>struts2-execute</filter-name>
      <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
      <init-param>
        <param-name>actionPackages</param-name>
        <param-value>com.peak6.weseed.webapp.admin.action</param-value>
      </init-param>
    </filter>
2.b sitemesh filter should sit in the middle of two struts filters:
BEFORE 2.1 :
    <filter-mapping>
        <filter-name>struts-cleanup</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
AFTER :
    <filter-mapping>
        <filter-name>struts2-prepare</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts2-execute</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

3. You may remove Codebehind Plugin (optional) as since 2.1 this plugin has been deprecated in favor of the Convention Plugin

Matt Raible added a comment - 25/Apr/09 05:24 PM
Patch for doing the upgrade. I tried, but it fails b/c users have to login for each page request. Also, signup fails with the following error:

Signup:
WARN [btpool0-3] VisitorFieldValidator.warn(45) | The visited object is null, VisitorValidator will not be able to handle validation properly. Please make sure the visited object is not null for VisitorValidator to function properly
WARN [btpool0-3] Dispatcher.warn(49) | Could not find action or result
No result defined for action org.appfuse.webapp.action.SignupAction and result input

Matt Raible made changes - 25/Apr/09 05:24 PM
Field Original Value New Value
Attachment struts-2.1-upgrade.patch [ 10543 ]
Matt Raible added a comment - 04/May/09 07:59 PM
I posted the following question on the Struts mailing list - no solution yet.

http://www.mail-archive.com/user@struts.apache.org/msg87713.html

Matt Raible made changes - 05/May/09 11:27 PM
Status Open [ 1 ] In Progress [ 3 ]
Matt Raible added a comment - 05/May/09 11:30 PM
Integration tests now pass on web/struts. However, integration tests still test when creating an archetype. Not sure why.

     [exec] PasswordHint:
     [exec] DEBUG [btpool0-3] PasswordHintAction.execute(45) | Processing Password Hint...
     [exec] WARN [btpool0-3] Dispatcher.warn(49) | Could not find action or result
     [exec] No result defined for action com.mycompany.webapp.action.PasswordHintAction and result success
     [exec] at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:363)

3239 by  Matt Raible (2 files)
06/May/09 12:16 AM (15 months, 19 days ago)
APF-1130: Finished upgrade to Struts 2.1. Still need to modify things to use conventions. Thanks to Dustin Pearce for solving all the remaining upgrade issues.
appfuse: trunk/archetypes/appfuse-basic-struts/src/pom.xml 3239 history download (+1 -1) diffs
appfuse: trunk/archetypes/appfuse-modular-struts/src/web/pom.xml 3239 history download (+1 -1) diffs

Matt Raible added a comment - 06/May/09 12:21 AM
Archetypes now work thanks to Dustin Pearce's help. Still need to refactor to use the convention plugin and change AMP to generate convention-friendly code.

3246 by  Matt Raible (1 file)
12/May/09 04:27 PM (15 months, 13 days ago)
Ivo Wever added a comment - 04/Nov/09 11:38 AM
Did you manage to solve the issue you mentioned on April 25th?:

"I tried, but it fails b/c users have to login for each page request."

I'm currently facing the same problem and would love to know what causes it.

Matt Raible added a comment - 04/Nov/09 11:42 AM
If you look at the FishEye tab on this issue, you should see all the changes related to it. Hopefully that'll help:

http://issues.appfuse.org/browse/APF-1130?page=com.atlassian.jira.ext.fisheye:fisheye-issuepanel

Ivo Wever added a comment - 09/Nov/09 01:36 AM
Thanks, I wasn't sure whether it was solved, but I understand it was. Now I also understand the response on the Struts mailing list: I missed the switch from struts2-codebehind-plugin to struts2-convention-plugin in the pom.

Matt Raible made changes - 17/Nov/09 12:33 AM
Fix Version/s 2.1.0-M1 [ 10031 ]
Fix Version/s 2.1.0-M2 [ 10210 ]
Matt Raible made changes - 17/Nov/09 12:33 AM
Status In Progress [ 3 ] Open [ 1 ]
Amir added a comment - 09/Jan/10 05:50 PM
Hi Matt,
I vote for it because JSON plugin bundled with Strus 2.1.7+ and by JSON plugin I'll use jQuery.
BTW it's possible to plug JSON plugin to earlier version.
Good luck.