• daveespo
  • NEWBIE
  • 10 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 7
    Replies

I am having a problem with the <apex:composition> tag. I have created my Sites application in my development org and packaged the VF pages and Controller into a managed package.

 

When I install the package into the destination org, the only Site Template I'm able to use is the site template that I packaged with my app. I want to allow the user to create their own Site Template (unmanaged, in their org) and set this page as the Site Template.

 

To be perfectly clear, this is what I'm doing:

 

<apex:page>
    <apex:composition template="{!$Site.Template}">
        <apex:define name="body">

            Blah blah blah

         </apex:define>
    </apex:composition>
</apex:page>

 

And the template I package with my app:

 

 <apex:page >
        <div class="content"><apex:insert name="body" /></div>
        <div class="footer">
            <apex:outputText value="Copyright 2009"/>

         </div>
</apex:page>

 

When I deploy my package, if i configure my Site to use the template that I've packaged, everything works fine. But the moment I change the Site Template to point at a different template that didn't come with my package, I get a 404/File Not Found

 

 

I am trying to retrieve the XML containing the list of Reports for my Organization using the document available at https://<server>.salesforce.com/servlet/ReportList.servlet

 

The way I'm retrieving this document from inside my VF controller is with this code:

 

Map<String, String> headers = ApexPages.currentPage().getHeaders();
String endpoint = 'https://' + headers.get('Host') + '/servlet/servlet.ReportList';
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setHeader('Cookie','sid=' + UserInfo.getSessionId());
req.setMethod('GET');
Http http = new Http();
HttpResponse res = http.send(req);
reportBody = res.getBody();

parseReportXml(reportBody);
 

This works fine for an Unmanaged VisualForce page ... but when I deploy my VF page in a Managed Package, this breaks down. The issue is that when you access a managed VF page, there is a big long redirection dance that issues you new cookies (and a new Session ID) for the server that the VF page resides at. The URL you finally end up at is a force.com URL (ex. https://<package prefix>.<server name>.visual.force.com/apex/<my page>)

 

So, there are two issues:

 

1) The use of the headers.get('Host') is no longer correct (since I'm no longer at <server>.salesforce.com) ... I can work around that because SF actually gives me a Redirect response if I try to run the above code

 

2) The Session ID inside my VF controller is not a valid SessionID for the <server>.salesforce.com server. This is what I can't figure out a workaround for.

 

Is there some way to have SF issue me a SessionID via some API that would be valid for the <server>.salesforce.com based on the SessionID I have for the visual.force.com domain?

 

Thanks,

Dave

I created my first Sites application on Friday. However, I am only able to get the 'landing page' to work. Any links from that page to other pages on the Site generate a "... is down for maintenance" message

 

I have authorized these pages to be part of my Site so it's not a permission problem. (prior to authorizing the pages, I was receiving a different error).

 

This is the error screen:

 

http://screencast.com/t/zhNh1NBwulZ

 

And this demonstrates taht the TicketPurchaseInstance page is authorized:

 

http://screencast.com/t/6MZbOEgnU

Hi All,

 

I got a question about Apex Exception emails. How can I setup apex exception emails to be sent to my account?

 

Am a developer and when I get these emails to my account, it helps me in looking specifically into where an unhandled exception has occurred and then try to fix it from there.  

 

Thanks,

YNR

  • June 01, 2009
  • Like
  • 0

I am trying to retrieve the XML containing the list of Reports for my Organization using the document available at https://<server>.salesforce.com/servlet/ReportList.servlet

 

The way I'm retrieving this document from inside my VF controller is with this code:

 

Map<String, String> headers = ApexPages.currentPage().getHeaders();
String endpoint = 'https://' + headers.get('Host') + '/servlet/servlet.ReportList';
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setHeader('Cookie','sid=' + UserInfo.getSessionId());
req.setMethod('GET');
Http http = new Http();
HttpResponse res = http.send(req);
reportBody = res.getBody();

parseReportXml(reportBody);
 

This works fine for an Unmanaged VisualForce page ... but when I deploy my VF page in a Managed Package, this breaks down. The issue is that when you access a managed VF page, there is a big long redirection dance that issues you new cookies (and a new Session ID) for the server that the VF page resides at. The URL you finally end up at is a force.com URL (ex. https://<package prefix>.<server name>.visual.force.com/apex/<my page>)

 

So, there are two issues:

 

1) The use of the headers.get('Host') is no longer correct (since I'm no longer at <server>.salesforce.com) ... I can work around that because SF actually gives me a Redirect response if I try to run the above code

 

2) The Session ID inside my VF controller is not a valid SessionID for the <server>.salesforce.com server. This is what I can't figure out a workaround for.

 

Is there some way to have SF issue me a SessionID via some API that would be valid for the <server>.salesforce.com based on the SessionID I have for the visual.force.com domain?

 

Thanks,

Dave

I created my first Sites application on Friday. However, I am only able to get the 'landing page' to work. Any links from that page to other pages on the Site generate a "... is down for maintenance" message

 

I have authorized these pages to be part of my Site so it's not a permission problem. (prior to authorizing the pages, I was receiving a different error).

 

This is the error screen:

 

http://screencast.com/t/zhNh1NBwulZ

 

And this demonstrates taht the TicketPurchaseInstance page is authorized:

 

http://screencast.com/t/6MZbOEgnU

Hi, 

 

I write a VF page with five date inputFields ,  

and I found the default today was displayed on the right of the inputfields.

It's:         [______][ 2009/02/18 ].

May it's name is 'datepicker.insertDate' .

It make my row very long .

Can just user the Date inputField without that 'today' option?

Infact, If I want a default value, I can set it in my controller or sobject. 

here's my code ,is just a date inputField.

 

<apex:repeat value="{!boList}"

var="boInfo" id="pageRepeat">

<tr>

<td>

<apex:inputField id="nday" style="width:80px;" value="{!boInfo.transferDay__c}" />

</td>

</tr>

<-- five same inputField here --> <-- ... --></tr></apex:repeat>

 

 thanks!!!

 

Message Edited by colorBoy on 02-18-2009 08:55 PM
I have an s-control that uses the AJAX proxy remoteFunction to connect to an external URL.  It has been working correctly for several months.  Over night the remoteFunction stopped working and only returns a read timeout error.
 
"400 Unable to forward request due to: Read timed out"
 
 I have eliminated and/or tested all of the other factors: connection to external site, browser, data error, IP address whitelists, etc.  I have tried using version 11 and 12 of the API.  I have also contacted the Sales Force support line with no avail.  I know that this can occur when Sales Force slows down, but it has never happened for this long 12+ hours.
 
I am left to assume that some issue with Sales Force occurred over night.  Any Ideas?
 
Code:
function postRequest(envelope) {

 sforce.connection.remoteFunction({
  url : "https://<deleted>",
  requestHeaders: {
   "Content-Type":"application/x-www-form-urlencoded; charset=utf-8"
  },
  requestData: envelope,
  method: "POST",
  onSuccess : postSuccess,
  onFailure : postFailure
 });

}