Exploring Public Folders in the Struts2 Web Application

I want to publish some resources (folders and files) under a folder inside the WebContent folder of my Struts2 application and allow free directory searches of this folder contents.

WebContent / public folder /.

Does anyone know how to achieve this?

All my attempts fail with the classic "There is no action displayed for the action name public-folder

I use the Sitemesh decorator and defined the following exception pattern:

<excludes>            
<pattern>/*public-folder*</pattern>
</excludes>                 

It seems that Im was unable to escape from running Struts2. Thank...

+3
source share
1 answer

Attention

There is no action displayed for the public-folder action name

due /*to filter

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Decision

struts.xml( Preventing Struts 2 from processing the request )

<!-- value : regular expressions -->
<constant name="struts.action.excludePattern" value="/public-folder/.*?" />


[Tomcat] /conf/web.xml

<init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value> <!-- default is false -->
</init-param>
+5
source

All Articles