Skip to main content

Expanders 5.29.0

· 3 min read
Frédéric Hannes
Frédéric Hannes
R&D Engineer

This release of Expanders is mostly focused around changes related to Struts2, amongst which the removal of all support for versions 2.3.x and 2.5.x, as well as the update to version 6.2.0.

Resources

The expansion resources below provide Expanders 5.29.0.

ResourceVersion
Expanders5.29.0
nsx-default-stack2023.13.0
rest-jaxrs-stack3.22.0

Changes and improvements

Removal of old version support

We have been working towards removing support for outdated versions of Struts2 for some time now. On July 1st, the deprecated option struts.version expired. We've now removed all support that relied on this option to target Struts 2.3 and 2.5. This was announced last year with the release of Expanders 5.15.0.

Struts 6.2

Struts version 6.2 was released yesterday as announced by Apache. This version brings mostly bugfixes and some improvements, but it also comes with some breaking changes. There's no official migration guide for this, but we've described some of these changes and the fixes in our migration guide below. Most of these changes will however be handled by our expanders, so the impact on projects should be fairly minimal.

Refactoring

With the refactoring needed for the new Struts update, we've also taken the time to revisit some of the code in our JEE stack related to Struts and made some minor improvements. This includes replacing remaining code that still pulled the UserContext object directly from the session with Context. Though UserContext remains part of the session for now, this might change in the future

Migration guide

Migrating to Struts 6.2

Changes to ActionContext

The most notable breaking change in Struts 6.2 is issue WW-5304, as there were extensive changes made to the ActionContext class (relevant commit), in order to clean up the code and improve consistency. The functionality of the class has not been changed, but many methods were renamed to be consistent and method chaining was also added. Calls to these methods should be refactored as follows:

  • Setters:
    • ActionContext.setActionInvocation()
      ActionContext.withActionInvocation()
    • ActionContext.setApplication()
      ActionContext.withApplication()
    • ActionContext.setConversionErrors()
      ActionContext.withConversionErrors()
    • ActionContext.setLocale()
      ActionContext.withLocale()
    • ActionContext.setName()
      ActionContext.withActionName()
    • ActionContext.setParameters()
      ActionContext.withParameters()
    • ActionContext.setSession()
      ActionContext.withSession()
    • ActionContext.setValueStack()
      ActionContext.setValueStack()
    • ActionContext.setContainer()
      ActionContext.withContainer()
  • Getters:
    • ActionContext.getName()
      ActionContext.getActionName()

Removed interfaces

Issue WW-5251 describes the removal of several interfaces, for which an alternative has been available for some time in the org.apache.struts2.action package. All code that still uses one of these interfaces should migrate to the alternative from that package. The interfaces that were removed are the following:

  • org.apache.struts2.util.ServletContextAware
  • org.apache.struts2.interceptor.ServletRequestAware
  • org.apache.struts2.interceptor.ServletResponseAware
  • org.apache.struts2.interceptor.ParameterAware
  • org.apache.struts2.interceptor.SessionAware
  • org.apache.struts2.interceptor.ApplicationAware
  • org.apache.struts2.interceptor.PrincipalAware
caution

These interfaces do not have the same signature, some minor refactoring may be required, though it is likely limited to the naming of methods.

info

Some classes in base-components were still implementing org.apache.struts2.interceptor.SessionAware. This has been replaced with org.apache.struts2.action.SessionAware, which required the renaming of the method setSession() to withSession().