0

I am trying to setup a URLResouceLoader as a store for all the template files. But the URL is secured with a username and password.

Is there any way to pass the username and password when I setup the VelocityEngine? My current code looks like:

// Initialize the Velocity Engine
velocityEngine = new VelocityEngine();

velocityEngine.setProperty(VelocityEngine.RESOURCE_LOADER, "url");
velocityEngine.setProperty(VelocityEngine.RESOURCE_LOADER_CHECK_INTERVAL, 2);
velocityEngine.setProperty(VelocityEngine.INPUT_ENCODING, StandardCharsets.UTF_8.name());
velocityEngine.setProperty("url.resource.loader.class", URLResourceLoader.class.getName());
velocityEngine.setProperty("url.resource.loader.root", APPProperties.configServerURL + "/webserver/cgs/templateFiles/");
velocityEngine.setProperty("resource.loader.url.timeout", 20);

velocityEngine.init();

But how do I pass the username/password to the URL? Any advice would be helpful. Thank you!

4

0 回答 0