Velocity IncludeEventHandler Dilemma

Here is an interesting problem with IncludeEventHandler.

I am developing a Spring-based application that uses speed for which different VENDORS have a separate portfolio site. I allow sellers to customize pages by providing them with Velocity templates that are stored in the database and are picked up by the speed engine using the DataSourceResourceLoader.

My table is organized like this .

Suppliers can analyze other patterns by invoking a macro #parseand passing them vendorid/template-namein to make it look like this.

#parse("20160109144/common-css.vm")

Now the actual problem is the collection of the template in accordance with vendorid. I have a class (extension IncludeEventHandler) that overrides the method includeEvent. Now, what can I do to return the desired template? I do not want to change the names and make them look like20160109144/home.vm

+4
source share
1 answer

With the OP question, the goal was to provide an alternative behavior for the DataSourceResourceLoader .

Unfortunately, the version of Velocity Engine version 1.7 does not have the ability to modify the SQL statement that is used to retrieve the template.

DataSourceResourceLoader ResourceLoader. , , ResourceLoader, , .

, glom DataSourceResourceLoader .

, , , . DataSourceResourceLoader , , .

, . , .

+1

Source: https://habr.com/ru/post/1623552/


All Articles