function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SurjenduSurjendu 

Request Headers and PageReference and new Web Tabs

Please let me know how to solve this usecase:

I have two tabs A and B

Tab A:

As part of Tab A, a VF page is invoked which has a custom controller. The VF page has a link. On click of the link I call one custom method in the controller.

<apex:commandLink action="{!openBrowser}"><apex:outputText value="Invoke extranet"/></apex:commandLink>

In the custom controller I have to create a HTTP Request , set some parameters in the request header(for Single Sign On) and send it to an endpoint outside SalesForce. Once the request is received by the intended server it, the server checks the
request header(for Single Sign On) and logs the user in the application and returns the homepae of the user. I want to show the homepage of the user in a separate Tab B in SalesForce. How do I achieve this?

public PageReference openBrowser() 
{
HttpRequest req = new HttpRequest();
req.setEndpoint('someendpoint');
req.setMethod('GET');
req.setHeader('XXX', 'SSOEnabled');

Http http = new Http();
HTTPResponse res = http.send(req);
//Now my question is how do i show the response which is an html on a separate tab
return new PageReference('/servlet/servlet.Integration?lid=01r700000006480&ic=1');
}

I know I can create a Web Tab but in that case I have to hard code the URL of the web tab. In that case i cannot set the request
headers.

Any help???