Created
December 29, 2011 05:05
-
-
Save macanderson/1532031 to your computer and use it in GitHub Desktop.
Apex Get Current URL Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @description Various Apex methods for working with URLs | |
* | |
* @author Mac Anderson | |
* | |
* @version 1.0 | |
* | |
* @moreinfo http://macscloud.com | |
*/ | |
public class UrlMethods { | |
String BaseUrl; // The Url w/o the page (ex: 'https://na9.salesforce.com/') | |
String PageUrl; // The Url of the page (ex: '/apex/SomePageName') | |
String FullUrl; // The full Url of the current page w/query string parameters | |
// (ex: 'https://na9.salesforce.com/apex/SomePageName?x=1&y=2&z=3') | |
String Environment; // Writing code that can detect if it is executing in production or a sandbox | |
// can be extremely useful especially if working with sensitive data. | |
public UrlMethods() { // Constructor | |
BaseUrl = URL.getSalesforceBaseUrl().toExternalForm(); // (Example: 'https://na9.salesforce.com/') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/**
*
*
*
*/
public class UrlMethods {
}