repositarian
Occasional Observer

Config Parameter "stripWelcomeFileNames" for AdvancedUrlFactory is not working

Jump to solution

Hello,

using the reference implementation of the AdvancedUrlFactory, we are trying to get an URL from the AdvancedUrlFactory with the config parameter "stripWelcomeFileNames" set to true (as it is listed in the documentation). 
We are using the parameter together with several others (see code).

Code:

AdvancedUrlFactory advancedUrlFactory = new AdvancedUrlFactory();
Map<String, String> config = Map.of(
	"uselowercase","true",
	"useregistry","false",
	"stripwelcomefilenames","true",
	"usewelcomefilenames","true"
);
PathLookup pathLookup = PathLookup.INSTANCE;
advancedUrlFactory.init(config, pathLookup);
String url = advancedUrlFactory.getUrl(pageRef, selfUrlTemplateSet, language, pageParams);

 

Now the problem is that "stripWelcomeFileNames" gets ignored:

Expected URL:

/somepath/


Actual URL:

/somepath/index.html

We also tried camelCase for the parameter but it's still not working.
What are we missing? How do we fix it?

Thank you in advance.

0 Kudos
1 Solution

Accepted Solutions

If you want to simulate what's happening during the generation process, you can use the RenderingAgent. Use the factory method where you can provide template code and use as a parameter a $CMS_REF template snippet. You can look at this code example for inspiration.

Peter

View solution in original post

3 Replies
Peter_Jodeleit
Crownpeak employee

This parameter is not used from the class, but it's used in the infrastructure during the generation process when calculating an URL (or more specific: a link). Only the parameters "usewelcomefilenames" and "uselowercase" have an affect when using the class directly.

Peter

Okay, 
how then can we make use of this parameter/functionality?

0 Kudos

If you want to simulate what's happening during the generation process, you can use the RenderingAgent. Use the factory method where you can provide template code and use as a parameter a $CMS_REF template snippet. You can look at this code example for inspiration.

Peter