SDL DXA, out of the box, has a PageController with the following Request Mapping
@RequestMapping(value = "/**", produces = {MediaType.TEXT_HTML_VALUE, MediaType.ALL_VALUE})
This is handling ALL request, regardless of extension
This could be updated to look like
@RequestMapping(value = { "/**/*.jsp", "/**/*.html", "/**/*.txt", "/**/*.xml" }, method = { GET })
However, you will also need to modify your web.xml
, which tells Spring MVC which urls to dispatch to the dispatcher (usually further defined in dispatcher-servlet.xml
), for example mine reads as below. It is telling Spring MVC to handle all of these requests
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/navigation/*</url-pattern>
<url-pattern>/system/*</url-pattern>
<url-pattern>*.html</url-pattern>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.txt</url-pattern>
<url-pattern>*.dcp</url-pattern>
<url-pattern>*.png</url-pattern>
<url-pattern>*.jpg</url-pattern>
<url-pattern>*.gif</url-pattern>
<url-pattern>*.jpeg</url-pattern>
<url-pattern>*.pdf</url-pattern>
<url-pattern>*.vcf</url-pattern>
<url-pattern>*.swf</url-pattern>
<url-pattern>*.zip</url-pattern>
<url-pattern>*.xls</url-pattern>
<url-pattern>*.xlsx</url-pattern>
</servlet-mapping>
I also have, as I want to ignore some JSPs, this to tell String MVC NOT to handle JSPs in /WEB-INF/views/
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/WEB-INF/views/*</url-pattern>
</servlet-mapping>
I think in your situation just removing <url-pattern>*.html</url-pattern>
would be enough to allow all HTML files to "pass through" and be resolved from the file-system.
Update following @Troy's comment
To exclude 2 folders of HTML files I'd try the following
Create web.xml file in your project - mine looks like this https://gist.github.com/chrismrgn/fdc1ec017664aeca0ef1ab70f72cc895
Then replace:
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/WEB-INF/views/*</url-pattern>
</servlet-mapping>
With:
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/html-folder-1/*</url-pattern>
<url-pattern>/html-folder-2/*</url-pattern>
</servlet-mapping>
Hope that helps?