2.14.3.5. Static resource handler

The "/" mapping for the "default" servlet is now replaced by mapping for the org.exoplatform.portal.application.PortalController servlet. It means that you need a handler (org.exoplatform.portal.application.StaticResourceRequestHandler) to serve static resources like image, CSS or JavaScript files in portal.war. And it should be configured, and extended easily thanks to the controller.xml file. This file can be overridden and can be changed and reloaded at runtime (WebAppController is MBean with some operations, such as reloadConfiguration()).

Declare StaticResourceHandler in controller.xml


<route path="/{gtn:path}">
  <route-param qname="gtn:handler">
    <value>staticResource</value>
  </route-param>
  <path-param encoding="preserve-path" qname="gtn:path">
    <pattern>.*\.(jpg|png|gif|ico|css)</pattern>
  </path-param>
</route>

And you do not need these kinds of the following mapping in the web.xml in portal.war anymore.


<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>*.jpg</url-pattern>
</servlet-mapping>
...
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus