You need to sign in to do that
Don't have an account?
Dilyan Dimitrov
URL Normalization
Hi,
Could you please suggest how to achieve URL Normalization in Salesforce.
What I am trying to achieve is to take particluar URL and modifie it to its most basic or standard form.
Example:
String url = "Http://Example.com:80//salesforce/index.html";
URL normalizedURL = new URLNormalizer(url)
.lowerCaseSchemeHost()
.removeDefaultPort()
.removeDuplicateSlashes()
.removeDirectoryIndex()
.addWWW()
.toURL();
System.out.println(normalizedURL.toString());
// Output: http://www.example.com/foo/
The above example was taken from existing java class called URLNormalizer. I was wondering if there is a similar way to achieve URL Normalization in Salesforce.
Please advise how to make URL Normalization in Salesforce.
Could you please suggest how to achieve URL Normalization in Salesforce.
What I am trying to achieve is to take particluar URL and modifie it to its most basic or standard form.
Example:
String url = "Http://Example.com:80//salesforce/index.html";
URL normalizedURL = new URLNormalizer(url)
.lowerCaseSchemeHost()
.removeDefaultPort()
.removeDuplicateSlashes()
.removeDirectoryIndex()
.addWWW()
.toURL();
System.out.println(normalizedURL.toString());
// Output: http://www.example.com/foo/
The above example was taken from existing java class called URLNormalizer. I was wondering if there is a similar way to achieve URL Normalization in Salesforce.
Please advise how to make URL Normalization in Salesforce.
Leslie Kismartoni
There isn't a default tool inside of the the platform that does this... You'd probably have to roll your own, perhaps based on/extending the Apex URL class (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_url.htm) ... I think looking at some of the java normalizers could help inform the approach?