Spring Boot + Struts2 Convention Plugin Not Working

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Spring Boot + Struts2 Convention Plugin Not Working

Rubens Gomes-4
I using Spring Boot + Struts2, and the convention plugin is not working.  That, is the request URL paths are not being automatically mapped  to their corresponding action classes at all.

Spring Boot: 1.5.19.RELEASE
Struts2: 2.5.20
Java VM JDK 1.8
Maven

I have the struts2-convention-plugin in my maven POM dependencies.  And I have registered the Struts2 StrutsPrepareAndExecuteFilter as a bean in Spring Boot, and the filter gets called in  the request filter chain. However, it is not resolving the incoming path to an action class using the convention plugin.

Below is a portion of my struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
    "http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
  <constant name="struts.devMode" value="true" />
  <constant name="struts.action.extension" value="do" />
  <constant name="struts.convention.action.packages"
    value="com.ezlista.web.struts2.action" />
  <constant name="struts.convention.classes.reload" value="true" />
  <constant name="struts.convention.default.parent.package"
    value="ezlista-package" />
  <constant name="struts.convention.package.locators" value="action" />
  <constant name="struts.convention.package.locators.basePackage"
    value="com.ezlista.web.struts2" />
  <constant name="struts.convention.result.path"
    value="/WEB-INF/content/" />
  <constant name="struts.custom.i18n.resources" value="messages" />
  <constant name="struts.date.format" value="dd/MM/yyyy hh:mm" />
  <constant name="struts.freemarker.templatesCache" value="true" />
  <constant name="struts.i18n.encoding" value="UTF-8" />
  <constant name="struts.objectFactory" value="spring" />
  <constant name="struts.serve.static" value="true" />
  <constant name="struts.ui.theme" value="simple" />
  <constant name="struts.ui.templateDir" value="template" />
  <constant name="struts.ognl.allowStaticMethodAccess " value="true" />

  <package name="ezlista-package" extends="json-default">
    <interceptors>
      <interceptor-stack name="ezlistaStack">
        <interceptor-ref name="defaultStack">
          <param name="exception.logEnabled">true</param>
          <param name="exception.logLevel">ERROR</param>
          <param name="exception.logCategory">com.ezlista</param>
          <param name="params.excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*,^_csrf</param>
        </interceptor-ref>
      </interceptor-stack>
    </interceptors>

    <default-interceptor-ref name="ezlistaStack" />
    <default-action-ref name="default-action" />
  </package>
.....
</struts>

<http://aka.ms/weboutlook>


Reply | Threaded
Open this post in threaded view
|

Re: Spring Boot + Struts2 Convention Plugin Not Working

Lukasz Lenart
Hi

I think it's do the fact that the plugin won't scan JARs by default
https://struts.apache.org/plugins/convention/#actions-in-jar-files


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

pon., 11 mar 2019 o 18:39 Rubens Gomes <[hidden email]> napisał(a):

>
> I using Spring Boot + Struts2, and the convention plugin is not working.  That, is the request URL paths are not being automatically mapped  to their corresponding action classes at all.
>
> Spring Boot: 1.5.19.RELEASE
> Struts2: 2.5.20
> Java VM JDK 1.8
> Maven
>
> I have the struts2-convention-plugin in my maven POM dependencies.  And I have registered the Struts2 StrutsPrepareAndExecuteFilter as a bean in Spring Boot, and the filter gets called in  the request filter chain. However, it is not resolving the incoming path to an action class using the convention plugin.
>
> Below is a portion of my struts.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
>     "http://struts.apache.org/dtds/struts-2.5.dtd">
> <struts>
>   <constant name="struts.devMode" value="true" />
>   <constant name="struts.action.extension" value="do" />
>   <constant name="struts.convention.action.packages"
>     value="com.ezlista.web.struts2.action" />
>   <constant name="struts.convention.classes.reload" value="true" />
>   <constant name="struts.convention.default.parent.package"
>     value="ezlista-package" />
>   <constant name="struts.convention.package.locators" value="action" />
>   <constant name="struts.convention.package.locators.basePackage"
>     value="com.ezlista.web.struts2" />
>   <constant name="struts.convention.result.path"
>     value="/WEB-INF/content/" />
>   <constant name="struts.custom.i18n.resources" value="messages" />
>   <constant name="struts.date.format" value="dd/MM/yyyy hh:mm" />
>   <constant name="struts.freemarker.templatesCache" value="true" />
>   <constant name="struts.i18n.encoding" value="UTF-8" />
>   <constant name="struts.objectFactory" value="spring" />
>   <constant name="struts.serve.static" value="true" />
>   <constant name="struts.ui.theme" value="simple" />
>   <constant name="struts.ui.templateDir" value="template" />
>   <constant name="struts.ognl.allowStaticMethodAccess " value="true" />
>
>   <package name="ezlista-package" extends="json-default">
>     <interceptors>
>       <interceptor-stack name="ezlistaStack">
>         <interceptor-ref name="defaultStack">
>           <param name="exception.logEnabled">true</param>
>           <param name="exception.logLevel">ERROR</param>
>           <param name="exception.logCategory">com.ezlista</param>
>           <param name="params.excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*,^_csrf</param>
>         </interceptor-ref>
>       </interceptor-stack>
>     </interceptors>
>
>     <default-interceptor-ref name="ezlistaStack" />
>     <default-action-ref name="default-action" />
>   </package>
> .....
> </struts>
>
> <http://aka.ms/weboutlook>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]