Thymeleaf 3 upgrade - No longer able to run a custom processor after one Thymeleaf processor and before a different Thymeleaf processor

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

Thymeleaf 3 upgrade - No longer able to run a custom processor after one Thymeleaf processor and before a different Thymeleaf processor

jaisenbrey
In Thymeleaf 2 we had a custom attribute processor used as `blc:price`. Because of how the processor precedence worked in Thymeleaf 2 we were able to have the processor precedence set where this would run before `th:block` and `th:remove` but after `th:with`. This doesn't seem easily done (if at all possible) in Thymeleaf 3 since dialects have precedences now. How we have it setup right now for the upgrade is the `ThymeleafSpringStandardDialect` has precedence 1000 and our Dialect has precedence 2000. With it setup this way it seems that I wouldn't be able to use any custom processors in a `th:block` tag since the block processor will run first and remove the tag before any of my processors get ran. If I put my dialect at 500 then we wouldn't be able to use variables created from `th:with` or `th:each` as a value to our custom processors in the same tag.

I'm not sure if this was intended or not or if it was intended and there's a way to make my situation work that I haven't found yet.

Thanks,
Jay
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf 3 upgrade - No longer able to run a custom processor after one Thymeleaf processor and before a different Thymeleaf processor

danielfernandez
Administrator
Why don't you set your dialect's precedence to the same value as the StandardDialect's precedence? If you need your processors to put themselves in a specific order related to processors in the StandardDialect, that should be the way to do it…

Actually, that is the reason why this precedence is a public constant: https://github.com/thymeleaf/thymeleaf/blob/thymeleaf-3.0.1.RELEASE/src/main/java/org/thymeleaf/standard/StandardDialect.java#L122
Reply | Threaded
Open this post in threaded view
|

Re: Thymeleaf 3 upgrade - No longer able to run a custom processor after one Thymeleaf processor and before a different Thymeleaf processor

jaisenbrey
Thank you for the extremely fast reply and I'm sorry for being so dense haha. That worked perfectly. The worst part was we were already using the constant and were adding 1000 to it. It didn't even click that I could just use the constant as the precedence.

Thanks again!