Hi Chan,

Don't write a separate Jaggery module for that. Just update the carbon
Jaggery module with your fixes.

/Ruchira


On Tue, Mar 11, 2014 at 5:08 PM, Chan <[email protected]> wrote:

> Had an offline chat with Kishanthan and we found that CarbonUtils or
> CarbonUIUtils will not provide us the answer. Reasons are that both classes
> will append /services or /carbon to the returned url. Another fact is that
> we have to pass in a Axis2Configuration for certain methods. We found out
> that there are system properties called 'mgt.transport.http.proxyPort' & 
> 'mgt.transport.http.port'
> which can be used to construct the full server address. I'll be writing a
> jaggery module on this and I'll share it once it's done.
>
> Cheers~
>
>
> On Tue, Mar 11, 2014 at 1:36 PM, Chan <[email protected]> wrote:
>
>> I implemented a method to jaggery to get the HttpSession. But I ran to
>> another issue where the CarbonConstants.SERVER_URL is getting null from
>> HttpSession & ServletContext.
>>
>> Caused by: java.lang.NullPointerException
>>         at
>> org.wso2.carbon.utils.CarbonUtils.getServerURL(CarbonUtils.java:773)
>>         at
>> org.wso2.carbon.utils.CarbonUtils.getServerURL(CarbonUtils.java:766)
>>         at
>> org.wso2.carbon.ui.CarbonUIUtil.getServerURL(CarbonUIUtil.java:105)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:601)
>>         at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
>>         ... 47 more
>>
>> I had a chat with Ruchira and he said they don't setup these values in
>> Jaggery. Are they setup in the Tomcat level? Or what could be the problem.
>>
>>
>>
>> On Tue, Mar 11, 2014 at 10:40 AM, Kishanthan Thangarajah <
>> [email protected]> wrote:
>>
>>> 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>*
>>>
>>
>>
>>
>> --
>> 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>*
>>
>
>
>
> --
> 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>*
>



-- 

*Ruchira Wageesha**Associate Technical Lead*
*WSO2 Inc. - lean . enterprise . middleware |  wso2.com <http://wso2.com>*

*email: [email protected] <[email protected]>,   blog:
ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>,
mobile: +94 77 5493444*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to