below is the apex method through which i am passing a URL string to a button in Visual force Page.
public Pagereference Submit(){
loanId1 = 'a2529000000MIBg';
String SessionId1 = Userinfo.getSessionID();
system.debug('here is your SessionId = '+ SessionId1);
string ServerURL1 = ApexPages.currentPage().getHeaders().get('Host');
system.debug('here is your ServerURL = '+ ServerURL1);
HttpRequest req = new HttpRequest();
req.setEndpoint('https://composer.congamerge.com/composer8/index.html');
req.setMethod('GET');
string Startdate1 = Startdate.format();
system.debug('Startdate1 = '+ Startdate1);
string Enddate1 = Enddate.format();
system.debug('Enddate1 = '+ Enddate1);
string Organizationid = UserInfo.getOrganizationId();
system.debug('Organizationid = '+ Organizationid);
String URL = 'https://composer.congamerge.com/composer8/index.html?sessionId='+SessionId1+'&serverUrl='+serverurl1+'/services/Soap/u/37.0/'+Organizationid+'&id='+LoanId1+'&templateid=a1U29000000l0vd&reportid=[trn]00O29000000Oo8o?pv1='+Startdate1+'&pv2='+Enddate1+'&defaultpdf=&ds7=3';
system.debug('Here is your URL =' + URL);
Pagereference Pageref = New pagereference(URL);
pageRef.setRedirect(true);
system.debug('here is your Pageref ='+ Pageref);
return Pageref;
}
}
the Pagereference method is breaking the URL. how to pass the URL in correct format as defined in the String URL. like this https://composer.congamerge.com/composer8/index.html? sessionId='+SessionId1+'&serverUrl='+serverurl1+'/services/Soap/u/37.0/'+Organizationid+'&id='+LoanId1+'&templateid=a1U29000000l0vd&reportid=[trn]00O29000000Oo8o?pv1='+Startdate1+'&pv2='+Enddate1+'&defaultpdf=&ds7=3';