I have a Restlet API and the methods exposed on it are called by a PHP web app. This web app is accessible by several domain names and depending on the do开发者_Go百科main certain aspects of the app are changed (look and feel, content etc).
Is there a way for Restlet to determine the URL of the calling web app? I have used getReference() but all I can get is the (internal) IP address of the calling web server (not the domain name).
My only other alternative is to pass the URL of the web app with every request to the API but it would be cleaner if Restlet already knew.
Thanks
Is the restlet hosted on the same machine (has the same IP) as the PHP app?
Try:
getRequest().getHostRef().getHostIdentifier();
or
getRequest().getHostRef().getIdentifier();
精彩评论