xmlet / HtmlFlow

HtmlFlow Java DSL to write typesafe HTML

Home Page:https://htmlflow.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HtmlView-Header.txt can't be loaded

DNagorny opened this issue · comments

Hi @fmcarvalho,

I really like your library for easily creating html docs. In my case I use it for a mail parsing component. Now the problem with version 1.1 (but not 1.0):

My mail parsing component is a maven dependency like yours. I have an application "main" which only uses my mail parsing component as dependency. I checked the resulting "main.war" and there was my mail parser jar as well as your htmlflow jar.

When I try to create a new Instance of my mail parser, which also invokes to create a instance of HtmlView<?>, an UncheckedIOException is thrown that it couldn't find HtmlView-Header.txt. Just for clarification the structure how everything is deployed within main.war:
--META-INF
--static
--WEB-INF
----classes
----lib
------mailParser1.0.jar
------htmlflow1.1.jar

I am still trying to debug it but for the moment I can tell that ClassLoader.getSystemResource("templates/HtmlView-Header.txt") (related to #16) is not looking at the right point to find the "HtmlView-Header.txt" because of the setup of your project being within another dependency.

Note:
The tests within the mail parser dependency can successfully create a mail parser instance.

I cannot reproduce this scenario. But I guess the problem is related with the ClassLoader context that is being used. Since you are using a WAR maybe it is being used a different folder convention specific to WAR files on ClassLoader.getSystemResource("templates/HtmlView-Header.txt").

I would like to solve this problem avoiding hardcoding like this HtmlView.header = "<!DOCTYPE html>";

@DNagorny can you check if the following uses solve this issue: HtmlView.class.getClassLoader().getSystemResource(….) ???

Sorry I didn't get notice from your comment :(. I just got notice for PR, so I answered you there.

@DNagorny I have already released version 1.2 which solves this problem. Can you check please if your tests pass with this new release and successfully load the HtmlView-Header.txt resource?

Ok I can check it on monday at work. Thanks so far!

As far as I can see it seems to be fixed.
Thank you very much!

@DNagorny As you may be aware, I am the author and primary advocate for the HtmlFlow Java library. As part of my continuous endeavors, I am required to provide justification for this project to my university.

HtmlFlow serves as a versatile auxiliary tool utilized across various sectors, facilitating software development by streamlining tasks such as HTML reporting automation, web templating, and more.

If you have utilized HtmlFlow, I kindly request your testimony regarding my dedication to addressing issues, implementing new features, or otherwise aligning with your requirements and/or your company within the scope of a specific project, task, or work that utilized HtmlFlow during a certain timeframe.

Your testimony will play a crucial role in demonstrating my work to my university.

Please feel free to send your testimonial to my email address at ISEL: miguel.gamboa@isel.pt

Thank you in advance for your attention and assistance.

@DNagorny Even if you are not currently using HtmlFlow, I kindly request your acknowledgment that I was actively engaged in maintaining, tracking issues, or new features during the time of this issue. It is imperative for me to justify my efforts on HtmlFlow during the period of this issue to my university.

I would greatly appreciate it if you could once again provide your acknowledgment to my email address at ISEL: miguel.gamboa@isel.pt.

Thank you in advance for your attention and assistance.