-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Qute - improve content type detection #11050
Conversation
mkouba
commented
Jul 29, 2020
- add config property for additional mappings
- resolves Qute: Unknown media type for suffix: .graphql #10991
- add config property for additional mappings - resolves quarkusio#10991
@gastaldi you would add |
Looks like a nice addition for 1.7. @gastaldi I let you review it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! Added one minor optional comment
if (suffix.equalsIgnoreCase("json")) { | ||
return Variant.APPLICATION_JSON; | ||
} | ||
String contentType = URLConnection.getFileNameMap().getContentTypeFor(fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use Files.probeContentType
too (or instead?) to take advantage of libraries that register their own java.nio.file.spi.FileTypeDetector
through the ServiceLoader mechanism
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about Files.probeContentType()
too but given the fact that the result may differ, based on the OS or presence of other libraries, I decided to choose the simple and straightforward solution for now. Also it seems that the default FileTypeDetector
impl is makes use of URLConnection.getFileNameMap()
anyway...
Merging this one. We can still improve on @gastaldi 's suggestion later. |