I have a component of resource type - granite/ui/components/foundation/form/pathbrowser , i need to make sure in case of internal link .html to be appended whereas in case of external link it should be as it is no .html appending. Can anyone help?
In case of Touch UI, we need to make use of Java Code only, I was not able to find any other options.
This is the code which I tried and it worked for me.
Here I am checking for the 4 cases:
1. Checking for file extension:- so if the file extension is .mp4 or .mp3 like that then we are not processing the URL and simply returning it.to check the different extension we have created an enum class. like this.
case 2: if URL is null or empty then we are sending null.
case 3: if URL starts with "/content" then we are appending ".html"
case 4: if URL starts with "http" or "https" or "www" then we are simply sending back the URL without performing any operation as it is an external link.