Externalize static resources (css, images, favicon, etc.)

67 views
Skip to first unread message

Dustin J Luck

unread,
Feb 4, 2020, 12:41:24 PM2/4/20
to CAS Community
I have successfully moved almost all of the customizations for my CAS environment out of the source folder in the overlay into external directories that can be referenced at run time without having to rebuild my cas.war file. The last parts I'm trying to externalize are in the \src\main\resources\static directory. If anyone has successfully done this or knows how to, I'd appreciate any help you can give.


Thanks


My environment:
  • Standalone CAS 6.0.5 build
  • Windows Server 2012 R2
  • Tomcat 9 running as a service


B Ran

unread,
Feb 5, 2020, 9:11:23 AM2/5/20
to CAS Community

Haven't tried on Windows, but on Linux with Embedded Tomcat, I could add some arguments to the service running Java

 -Dspring.resources.static-locations=file:/opt/cas/theme/static/  -Dspring.thymeleaf.prefix=file:/opt/cas/theme/templates/ -Dspring.thymeleaf.cache=false  -Dspring.resources.cache.period=0

Dustin J Luck

unread,
Feb 7, 2020, 6:24:27 PM2/7/20
to CAS Community
Thanks. I was able to get this to work with a couple of modifications.

First of all, I added the settings to my cas.properties file rather than setting them on the command line. I did this so I can keep as many of the changes in source control as possible.

Second, I had to modify the static locations prop as follows:
spring.resources.static-locations=file:///etc/cas/resources/,classpath:/static/

Without the classpath, CAS was only serving files from my local directory and I only wanted to externalize the resources I'm adding and overriding.
Reply all
Reply to author
Forward
0 new messages