There is a very interesting post over at the Salesforce.com blog with sample code for integrating Salesforce.com's session ID and server URL with composite applications. I never thought about this approach before but it may sure come in handy in the future.