This library provides a thymeleaf3 dialect that resolves esi:include tags.
When property esiinclude-thymeleaf-dialect.dialect-enabled is true, esi-includes will be resolved and their responses put into the output stream of the webpage.
-
Add a dependency to this library to your project:
implementation de.otto:esi-include-thymeleaf3-dialect:<version> -
Provide a Fetch function that is used to resolve esi includes. If a dependency to
com.ning:async-http-clientis present, such a function is provided automatically.Otherwise you need to provide a spring bean with type Fetch yourself. The function takes the source url as its argument and returns a
Responseobject.Make sure that your Fetch-function handles redirects, as this library does not do it.
-
Set property
esiinclude-thymeleaf-dialect.dialectEnabledtotrueso that the esi dialect is actually used -
Optional: Set property
esiinclude-thymeleaf-dialect.prefixForRelativePathto[http|https]://<hostname>to prefix relative esi:include src urls. -
Optional: Set property
esiinclude-thymeleaf-dialect.proxyEnabledtotrueto enable and start a local proxy. This proxy sets the headerAccess-Control-Allow-Originto*so that problems with CORS are prevented.The following properties configure the proxy:
proxyRedirectProtocol- protocol used for redirects, default ishttpsproxyRedirectHost- host where to redirect toproxyPort- port where the proxy is listening, default is8085
- Update dependencies (including update to spring boot 3.4.4)
- Publish library via central.sonatype.com instead of oss.sonatype.org
- Update to spring boot 3.2.2
- Build with java 17 / gradle 8
- Update to spring boot 3 / spring 6
- Add property
enabled-uris. It's now possible to restrict resolving of esi includes. When set only esi includes that are contained in responses of request uris that start with one of the configuredenabled-urisare resolved. When not set, all esi includes are resolved as before.
- Updates to Spring 5.x, Spring Boot 2.x
- Remove default fetch configuration
- Provide default fetch implementation even when
dialect-enabledis false since it is used by both the proxy and the esi dialect.
- Fix logging
- Catch BindException when proxy port is already in use. This may happen during spring integration tests when spring caches multiple application contexts.
- Stop proxy on context shutdown in @PreDestroy
- Activate esi dialect by property
esiinclude-thymeleaf-dialect.dialect-enabledinstead of by spring profiles
- Add properties
esiinclude-thymeleaf-dialect.proxy-redirect-hostandesiinclude-thymeleaf-dialect.proxy-redirect-schemeto make redirect host and scheme configurable.
- Extract EsiContentResolver into separate Bean.
- Add proxy to avoid CORS errors when resources are loaded within an esi-included page. Proxy can be enabled using the property
esiinclude-thymeleaf-dialect.proxy-enabled. The port can be set withesiinclude-thymeleaf-dialect.proxy-port, default is8085.
-
Add spring properties bean for property
esiinclude-thymeleaf-dialect.prefixForRelativePathso that you get syntax highlighting and code completion in your application*.yml files in your IDE.This property may now also be written "
prefix-for-relative-path"
- Add javadoc
- Rename variables and httpClient to Fetch
- Rename property
esiinclude-thymeleaf-dialect.hostnametoesiinclude-thymeleaf-dialect.prefixForRelativePath
Provide asyncHttpClient as httpClient when com.ning:async-http-client dependency is provided
Initial version