Sonntag, 18. November 2012
Link static content using spring MVC (e.g. favicon, apple toch icon, robots.txt etc.)
Spring MVC supports a "bypass" for static files, named resources. This is useful for accessing resources like favicon or static robots.txt.
Here is a little example spring config:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd>
<mvc:resources mapping="/favicon.ico" location="/static/favicon.ico" cache-period="43200"/>
<mvc:resources mapping="/apple-touch-icon-precomposed.png" location="/static/apple-touch-icon-precomposed.png" cache-period="43200"/>
<mvc:resources mapping="/robots.txt" location="/static/robots.txt" cache-period="43200"/>
</beans>
see also:
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen