>From UI front, the easy way to get the server url is to use the above method.
>From a UI related component, the easy way is to use "CarbonUIUtils#getServerURL(ServerConfigurationService serverConfig)" method, where you need to acquire the ServerConfigurationService. On Mon, Mar 10, 2014 at 10:35 PM, Chan <[email protected]> wrote: > Hi folks, > I looked into CarbonUIUtils and found an interesting method *public > static String getServerURL(ServletContext servletContext, HttpSession > httpSession). *I can get the ServletContext from the application > host-object but there seems to be no method to obtain the vanilla > HttpSession from the session host-object. @Ruchira shall we improve the > session host-object to have method to get HttpSession? > > Also I hope CarbonUIUtils won't be removed in the future refactoring. > > Cheers~ > > > On Mon, Mar 10, 2014 at 2:33 PM, Afkham Azeez <[email protected]> wrote: > >> IIRC, the CarbonUtils or CarbonUIUtils class has methods to retrieve the >> server host & ports. >> >> >> Azeez >> >> >> On Mon, Mar 10, 2014 at 2:28 PM, Chan <[email protected]> wrote: >> >>> Hi folks, >>> I am having a confusion regarding how to find the carbon server hostname >>> and port. This problem is related to implementing SSO in jaggery >>> applications. Say for example in the login.jag we construct the current >>> hostname to return a form to client to go to the IDP provider page. For >>> this we need to find the https://server_adress:port/admin/samlsso. For >>> this the login.jag currently use - >>> >>> var host = process.getProperty('server.host') >>> if(host=="localhost"){ >>> var postUrl = "https://" + process.getProperty('carbon.local.ip') >>> + ":" + process.getProperty('https.port'); >>> }else{ >>> var postUrl = "https://" + host; >>> } >>> >>> To get the server to work in development we get 'carbon.local.ip' from >>> process and set it up. For production we suggest users to add the hostname >>> in the carbon.xml file. 'server.host' will be populated with carbon.xml >>> entry in runtime. >>> >>> The problem in this approach is that we can't specify ports in the >>> carbon.xml entry. To overcome this -the quick fix for this would be to >>> append port to the host. But if we do that - proxy scenario is not covered. >>> What happens is that 'https.port' will return the carbon server port (9443) >>> but not the proxy port. If we expose the 9443 port to the client it will >>> not be reachable cause that port is blocked from the inside. >>> >>> Is there away to get the current address of the server - which get the >>> address from local ip for development and full address for production that >>> we can return for the client (browser)? >>> >>> Cheers~ >>> >>> -- >>> Chan (Dulitha Wijewantha) >>> Software Engineer - Mobile Development >>> WSO2Mobile >>> Lean.Enterprise.Mobileware >>> * ~Email [email protected] <[email protected]>* >>> * ~Mobile +94712112165 <%2B94712112165>* >>> * ~Website dulitha.me <http://dulitha.me>* >>> * ~Twitter @dulitharw <https://twitter.com/dulitharw>* >>> *~SO @chan <http://stackoverflow.com/users/813471/chan>* >>> >> >> >> >> -- >> *Afkham Azeez* >> Director of Architecture; WSO2, Inc.; http://wso2.com >> Member; Apache Software Foundation; http://www.apache.org/ >> * <http://www.apache.org/>* >> *email: **[email protected]* <[email protected]> >> * cell: +94 77 3320919 <%2B94%2077%203320919> blog: * >> *http://blog.afkham.org* <http://blog.afkham.org> >> *twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >> * linked-in: **http://lk.linkedin.com/in/afkhamazeez >> <http://lk.linkedin.com/in/afkhamazeez>* >> >> *Lean . Enterprise . Middleware* >> > > > > -- > Chan (Dulitha Wijewantha) > Software Engineer - Mobile Development > WSO2Mobile > Lean.Enterprise.Mobileware > * ~Email [email protected] <[email protected]>* > * ~Mobile +94712112165 <%2B94712112165>* > * ~Website dulitha.me <http://dulitha.me>* > * ~Twitter @dulitharw <https://twitter.com/dulitharw>* > *~SO @chan <http://stackoverflow.com/users/813471/chan>* > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Kishanthan Thangarajah* Senior Software Engineer, Platform Technologies Team, WSO2, Inc. lean.enterprise.middleware Mobile - +94773426635 Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>* Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
