Q:

How we can fetch url values in Apex class?

public with sharing class pageurlclass{
 
         /**
         * Webkul Software.
         *
         * @category  Webkul
         * @author    Webkul
         * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
         * @license   https://store.webkul.com/license.html
         */
 
    public  String  headerdata{get;set;}
    public string urlvalue{get;set;}
    public string url{get;set;}
        
    public pageurlclass(){
        
         headerdata= ApexPages.currentPage().getHeaders().get('Host');
        
         urlvalue=Apexpages.currentPage().getUrl();
        
         url='https://' + headerdata+ urlvalue;
    }
  
 
}
0
<apex:page controller="pageurlclass">
 
   <!-- 
        /**
         * Webkul Software.
         *
         * @category  Webkul
         * @author    Webkul
         * @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
         * @license   https://store.webkul.com/license.html
         */
         -->
      
  1.  {!headerdata}
 
  2.  {!urlvalue}
 
  3.  {!url}
 
</apex:page>
0

New to Communities?

Join the community