Skip to content

Commit d163492

Browse files
committed
doc: updates assets usage fix #3598
1 parent 82b29ed commit d163492

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

docs/asciidoc/static-files.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,26 @@ supports classpath and file-system resources.
77
[source, java, role="primary"]
88
----
99
{
10-
assets("/static/*"); <1>
10+
assets("/static/*", "/source"); <1>
1111
}
1212
----
1313

1414
.Kotlin
1515
[source, kotlin, role="secondary"]
1616
----
1717
{
18-
assets("/static/*") <1>
18+
assets("/static/*", "/source") <1>
1919
}
2020
----
2121

22-
<1> Map all the incoming request starting with `/static/` to the root of classpath
22+
<1> Map all the incoming request starting with `/static/` to the `/source` classpath or file system location.
2323

24-
- GET `/static/index.html` => `/index.html`
25-
- GET `/static/js/file.js` => `/js/file.js`
26-
- GET `/static/css/styles.css` => `/css/styles.css`
24+
- GET `/static/index.html` => `/source/index.html`
25+
- GET `/static/js/file.js` => `/source/js/file.js`
26+
- GET `/static/css/styles.css` => `/source/css/styles.css`
27+
28+
The `/source` is resolved against the file system by prepending the `user.dir` path when exists
29+
it favors the file system source, otherwise the `/source` directory must be present on classpath.
2730

2831
.File system resources:
2932
[source, java, role="primary"]
@@ -243,4 +246,4 @@ an exception or generating any other content you want:
243246
// render MyAssetException as you want
244247
}
245248
}
246-
----
249+
----

0 commit comments

Comments
 (0)