Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vert.x-Web Documentation Bug: Serving Static Resources #265

Closed
kva1966 opened this issue May 10, 2017 · 1 comment
Closed

vert.x-Web Documentation Bug: Serving Static Resources #265

kva1966 opened this issue May 10, 2017 · 1 comment

Comments

@kva1966
Copy link

kva1966 commented May 10, 2017

The documentation at http://vertx.io/docs/vertx-web/kotlin/#_serving_static_resources says:

In the following example all requests to paths starting with /static/ will get served from the directory webroot:

router.route("/static/*").handler(StaticHandler.create())

For example, if there was a request with path /static/css/mystyles.css the static serve will look for a file in the directory webroot/static/css/mystyle.css.

It will also look for a file on the classpath called webroot/static/css/mystyle.css. This means you can package up all your static resources into a jar file (or fatjar) and distribute them like that

The paths in the examples are incorrect.

Given the route spec, /static/* maps to /webroot/*, not /webroot/static/*.

The doco should thus read:

For example, if there was a request with path /static/css/mystyles.css the static serve will look for a file in the directory webroot/css/mystyle.css.

It will also look for a file on the classpath called webroot/css/mystyle.css. This means you can package up all your static resources into a jar file (or fatjar) and distribute them like that

Seems to have caused confusion where people have ended up missing the point and just changed the route to match more liberally, e.g. one of the answers here: http://stackoverflow.com/questions/31778971/vertx-web-where-do-i-place-webroot-folder#33856640

@tsegismont
Copy link

tsegismont commented May 11, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants