Serving static aliased files (resolves #1086) #1090
Conversation
|
Thanks @sealedtx ! Can you think of any scenario where you want some Maybe we can go for It would be nice if you could write all of the new functionality into a new class ( That way we're sure the new functionality won't affect the old. |
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Outdated
Show resolved
Hide resolved
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Outdated
Show resolved
Hide resolved
|
@tipsy I am not very experienced with serving aliased files and hardly even imagine the scenario when aliased files should be blocked. In my case I needed to allow aliased files.
I understand, it looks like edge case. I just used to design code to cover as much cases as possible if it doesn't hurt any other aspects. |
|
@tipsy After reading this, I doubt about your suggestion. Moreover if it is known fact that Javalin uses directly jetty's As a compromise solution: |
|
I'm okay with both of your suggestions @sealedtx, please go ahead and update the PR. |
|
All |
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Outdated
Show resolved
Hide resolved
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Outdated
Show resolved
Hide resolved
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Show resolved
Hide resolved
javalin/src/main/java/io/javalin/http/staticfiles/JettyResourceHandler.kt
Outdated
Show resolved
Hide resolved
Why? There is no word symlink, even IDEA highlights it as typo. |
|
If I google |
|
@tipsy Oh sorry, my fail) |
|
Thank you @sealedtx, looks good! Let me know when you are ready for merge. |
|
@tipsy I believe it is ready to merge |
|
@tipsy Are you going to include this PR in the next release? |
Yes! |
|
@sealedtx did some cleanup for resource handling: https://github.com/tipsy/javalin/pull/1092/files This also fixes the case where you have both prefix-handlers and aliasing enabled. Please have a look! |
|
This is out now ! https://javalin.io/news/2020/11/14/javalin-3.12.0-released.html |
Resolves #1086
Added possibility to set alias checks to serve static files. Because
ResourceHandlerwas called manually it was impossible to attach context to enable jetty's alias checks. So I re-implementedResourceHandler.getResource()to check aliases set by user inStaticFileConfigduring configuring Javalin config.Example: