1

My web application is generated using Jhipster framework. It is a gateway application and I am using reactive spring-boot. I can see a web.xml is generated and it has <mime-mapping> tag inside <web-app>. Is this actually needed for a spring-boot application?

5
  • Probably not, it should be possible to do the same via code or maybe simply using Spring Boot defaults. This web.xml file was added years ago so it could be obsolete now. Try removing it, and get an *.html page to see if returned mime-type is correct, if it is then submit a pull request on github. Jul 14 at 18:11
  • @GaëlMarziou I removed it, and I have a spring-boot angular application generated with Jhipster. I am getting the pages as well. Could you please let me know how to verify the check what you told?
    – Aryan
    Jul 14 at 20:08
  • As you have seen, this mapping is for *.html resources : JHipster has index.html for frontend app but also 404.html. So I suppose (not tested) you could simply refer to a resource that does not exist like localhost:8080/unknown and verify in browser's console that response mime type header is set to "text/html;charset=utf-8". You can do it also with curl. Jul 14 at 21:07
  • @GaëlMarziou I am getting the error page, but before removing and after removing the web.xml I am getting the content-type as application/problem+json for 404 page. Also I found this older issue: github.com/jhipster/generator-jhipster/issues/10698, whether this has any impact here?
    – Aryan
    Jul 17 at 13:27
  • I don't know how to test it so. You're right about this issue, the web.xml makes total sense when deploying to a server rather than using embedded server. I think that there should be a comment in the file explaining it. Jul 17 at 18:00

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.