Template not accessible downloading a PDF online with Spring Boot 2.0.3

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Template not accessible downloading a PDF online with Spring Boot 2.0.3

Aleix
I'm downloading a PDF file with a web app, developed with Spring Boot 2.0.3 and using Thymeleaf, from an admin section, protected with Spring Security. Locally it works fine, but online I get this error:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/email/confirmedbooking", template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause

At this address from StackOverflow I have exposed the same problem, with an extract of my code:

https://stackoverflow.com/questions/51666888/thymeleaf-template-not-accessible-downloading-a-pdf-online-with-spring-boot-2-0

Any help will be very much appreciated.
Aleix Alcover
Reply | Threaded
Open this post in threaded view
|

Re: Template not accessible downloading a PDF online with Spring Boot 2.0.3

Aleix
I have been able to solve the issue, taking out the first / from /email/confirmedbooking, leaving the code like this:

byte[] data = pdfGenerator.createPdf("email/confirmedbooking", map, idlanguage);

It seems that it didn't recognise the path, probably because of the double slash issue, already explained at this post: Error resolving template with Spring Boot using Thymeleaf packaged in a jar