Hi,

We have came up with this best practise. There are basically two scenarios;

1. When the back-end is belongs to your product(eg. calling BPS runtime).

We assume that you have written your JAX-RS based on an OSGi service.
JAX-RS will *not* hold any business logic and act as API interface(Facade
Pattern). In this case making a network call(AJAX) from UI to your own VM
is discouraged. You should use callOsgiService() function on the server
side Js.

2. When the back-end is external(eg. calling Twitter API).

Here we don't provide any server side feature for handling HTTP calls
because this will again abuse and use to call own VM back-ends. You can
simply write AJAX calls from UI using $.ajax() in jquery or XMLHttpRequest
in client-side Js.

* In the edge cases that you really need to make HTTP calls from the server
side Js, you can initiate; apache commons 'HttpClient' or java.net
'URLConnection' through Nashorn.

* Also you might still need to write JAX-RS APIs for your OSGi services for
customers.

Thanks,
Rasika

On Fri, May 20, 2016 at 10:42 AM, Chathura Ekanayake <chath...@wso2.com>
wrote:

> So there is not separation between UI back-end and the actual server (e.g.
> BPS runtime)? i.e. both always run in the same jvm?
>
> On Thu, May 19, 2016 at 11:47 PM, Manuranga Perera <m...@wso2.com> wrote:
>
>> Yes, you will be able to call OSGi services.
>>
>> On Thu, May 19, 2016 at 12:53 PM, Hemika Kodikara <hem...@wso2.com>
>> wrote:
>>
>>> Hi All,
>>>
>>> For clarification, does this mean we will be able to invoke a service
>>> side function(through nashorn) upon client request ? As in when a user
>>> clicks a button, we can call a server side function ?
>>>
>>> Regards,
>>> Hemika
>>>
>>> Hemika Kodikara
>>> Software Engineer
>>> WSO2 Inc.
>>> lean . enterprise . middleware
>>> http://wso2.com
>>>
>>> Mobile : +94777688882
>>>
>>> On Thu, May 19, 2016 at 3:43 PM, SajithAR Ariyarathna <sajit...@wso2.com
>>> > wrote:
>>>
>>>> Hi Sudharma,
>>>>
>>>> In the browser (client-side), you can do AJAX calls to the necessary
>>>> REST APIs. However, doing HTTP requests from UI backend (which runs on the
>>>> server-side) to REST APIs (which also runs on the server-side) is not
>>>> recommended. Instead of that you should call OSGi services. Calling OSGI
>>>> services from server-side JS will be available in the next milestone of 
>>>> UUF.
>>>>
>>>> Thanks.
>>>>
>>>> On Thu, May 19, 2016 at 2:21 PM, Sudharma Subasinghe <
>>>> sudhar...@wso2.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I am working on developing BPMN explorer ui using Unified UI
>>>>> Framework.
>>>>>
>>>>> The existing BPMN explorer ui is for BPS which has built on C4 and it
>>>>> is used Jaggery. So, I am working on BPMN explorer ui for BPS which is to
>>>>> be released on C5.
>>>>>
>>>>> We need to implement business logics in backend. For example, I need
>>>>> to send request to backend from browser, and from backend to BPS. Is there
>>>>> functionality to achieve it in UUF?
>>>>>
>>>>> Any idea on this is appreciated.
>>>>>
>>>>> Thanks
>>>>> Sudharma
>>>>>
>>>>> --
>>>>> Sudharma Subasinghe,
>>>>> Software Engineer,
>>>>> WSO2 Inc.
>>>>> Email: sudhar...@wso2.com <hasi...@wso2.com>
>>>>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Sajith Janaprasad Ariyarathna
>>>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>>>>
>>>> _______________________________________________
>>>> Architecture mailing list
>>>> architect...@wso2.org
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>
>>>>
>>>
>>
>>
>> --
>> With regards,
>> *Manu*ranga Perera.
>>
>> phone : 071 7 70 20 50
>> mail : m...@wso2.com
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
With Regards,

*Rasika Perera*
Software Engineer
M: +94 71 680 9060 E: rasi...@wso2.com
LinkedIn: http://lk.linkedin.com/in/rasika90

WSO2 Inc. www.wso2.com
lean.enterprise.middleware
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to