Skip to main content

Native Browser to WebKit Browser Migration

For all migrations using Eclipse, add the following required dependencies to your plug-in project:

  • com.sabre.edge.platform.optional.webkit

Proxy settings

WebKit browser uses proxy settings set in the Sabre Red 360 login window.

Native Browser editor to WebKit editor migration

  1. Own custom editor implementation: You have to extend different classes:

    • for editor class change extended class from com.sabre.edge.platform.optional.browser.editors.DefaultBrowserEditor to com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor

    • instead of input class com.sabre.edge.platform.optional.browser.inputs.BrowserEditorInput extend handler class com.sabre.edge.platform.optional.webkit.handlers.DefaultFocusOrOpenWebkitEditorHandler and implement getEditorUrl method.

For sample implementation see com.sabre.redapp.example.webkit sample.

  1. Editor defined in plugin.xml:

You must change class of editor used in editor or editorApp extension point.

Before:

<extension point="org.eclipse.ui.editors">
       <editor
             class="com.sabre.edge.platform.optional.browser.editors.DefaultBrowserEditor"
             icon="images/icon.png"
             id="com.sabre.redapp.example.browser.editor.SimpleBrowserEditor"
             name="Simple Browser">
       </editor>
</extension>

 <extension point="com.sabre.edge.platform.core.editor.editorApp">
       <editorApp
             browserURL="https://www.sabreredappcentre.sabre.com/"
             class="com.sabre.edge.platform.optional.browser.editors.DefaultBrowserEditor"
             constraintMaximum="1"
             constraintStartup="0"
             editorId="com.sabre.redapp.example.browser.editor.SimpleBrowserEditor"
             evalId="com.sabre.redapp.example.simple.browser.editor"
             name="Simple Browser"
             order="100"
             toolTipText="Simple Browser">
       </editorApp>
 </extension>

After:

<extension point="org.eclipse.ui.editors">
       <editor
             class="com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor"
             icon="images/icon.png"
             id="com.sabre.redapp.example.browser.editor.SimpleBrowserEditor"
             name="Simple Browser">
       </editor>
</extension>

 <extension point="com.sabre.edge.platform.core.editor.editorApp">
       <editorApp
             browserURL="https://www.sabreredappcentre.sabre.com/"
             class="com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor"
             constraintMaximum="1"
             constraintStartup="0"
             editorId="com.sabre.redapp.example.browser.editor.SimpleBrowserEditor"
             evalId="com.sabre.redapp.example.simple.browser.editor"
             name="Simple Browser"
             order="100"
             toolTipText="Simple Browser">
       </editorApp>
 </extension>

Native Browser view to WebKit view migration

  1. Own custom view implementation: You have to extend different classes: for view class change extended class from com.sabre.edge.platform.optional.browser.views.BrowserView to com.sabre.edge.platform.optional.webkit.views.WebkitView

  2. View defined in plugin.xml: you must change class of view used in view extension point:

Before:

<extension
         point="com.sabre.edge.platform.core.ui.viewApp">
         <viewApp
               browserURL="https://www.sabreredappcentre.sabre.com/"
               viewId="com.sabre.redapp.example.webkit.SimplifiedApi" />
</extension>
 <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="true"
            class="com.sabre.edge.platform.optional.browser.views.BrowserView"
            icon="images/icon.png"
            id="com.sabre.redapp.example.webkit.SimplifiedApi"
            name="Simplified Webkit API View"
            restorable="true">
      </view>
 </extension>

After:

<extension
         point="com.sabre.edge.platform.core.ui.viewApp">
         <viewApp
               browserURL="https://www.sabreredappcentre.sabre.com/"
               viewId="com.sabre.redapp.example.webkit.SimplifiedApi" />
</extension>
 <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="true"
            class="com.sabre.edge.platform.optional.webkit.views.WebkitView"
            icon="images/icon.png"
            id="com.sabre.redapp.example.webkit.SimplifiedApi"
            name="Simplified Webkit API View"
            restorable="true">
      </view>
 </extension>

 

Communication Services APIs migration

Usage of JavaScript Communication Services in WebKit browser is as follows:

  • SR360 OSGi communication service API

Native Browser

WebKit browser

callOSGIService

SrwOSGiApi.callOSGIService

callOSGIService JavaScript function must be invoked in WebKit browser using SrwOSGiApi variable reference name, for e.g.:

SrwOSGiApi.callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","getPcc", null);

In Browser c allOSGIService()received mandatory parameters: OSGi service name and method name. Optionally any number of parameters to be passed to method call, for e.g.:

callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","isCapabilityEnabled", "capability", "95TB")

or

callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","getAgentId")

In WebKit Browser parameters of OSGi service method must be passed as an array or null if no parameter required, for e.g.:

SrwOSGiApi.callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","isCapabilityEnabled", ["capability", "95TB"]);

or

SrwOSGiApi.callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","getAgentId", null);
  • Asynchronous SR360 OSGi communication service API

It is possible to call OSGi services from WebKit browser in an asynchronous way. To do so the SrwAsyncOSGiApi needs to be used. For example, to call IAgentProfileService to get the Agent Id one could use code as presented below:

SrwAsyncOSGiApi.callOSGIService("com.sabre.edge.platform.core.sso.base.IAgentProfileService","getAgentId", null, callbackFunction);

...

function callbackFunction(response) {
    //handle response
}
  • SR360 API

Native Browser

WebKit browser

lock()

SrwApi.lock()

lock(timeout)

SrwApi.lock(timeout)

unlock(lockId)

SrwApi.unlock(lockId)

host(cmd)

SrwApi.host(cmd)

host(cmd, lockId)

SrwApi.host(cmd, lockId)

sds(appId, subsetId, actionCode)

SrwApi.sds(appId, subsetId, actionCode)

sds(appId, subsetId, actionCode, lockId)

SrwApi.sds(appId, subsetId, actionCode, lockId)

showInEmu(command)

SrwApi.showInEmu(command)

showInEmu(command, isCommand)

SrwApi.showInEmu(command, isCommand)

executeInEmu(command)

SrwApi.executeInEmu(command)

executeInEmu(command, showCommand, showResponse)

SrwApi.executeInEmu(command, showCommand, showResponse)

lock()

SrwApi.lock()

sws(xml, action)

SrwApi.sws(xml, action)

sws(xml, action, lockId)

SrwApi.sws(xml, action, lockId)

getHighlight()

SrwApi.getHighlight()

sso(serviceProvider, assertionParams)

SrwApi.sso(serviceProvider, assertionParams)

In WebKit browser all predefined functions must be invoked using SrwApi variable reference name, for e.g.:

lock() function must be invoked as SrwApi.lock() from JavaScript code.

Parameters of SR360 API functions remains the same except:

sso() function: in Native Browser the second parameter of this function is an array (this parameter is optional for Native Browser and for WebKit browser we must send null if we don’t want to send any value):

sso("serviceProvider", [['address','Cracow, Poland'],['provider','Sabre']]);

Webkit Browser  SrwApi.sso()__ function receives json map as a parameter:

SrwApi.sso("serviceProvider", {'address':'Cracow, Poland','provider':'Sabre'});
  • SR360 asynchronous API

Similar to Api exposed in Native Browser, WebKit Browser also supports asynchronous calls to Communication Framework Services. To do so, one needs to use functions from SrwAsyncApi object. All functions of SrwAsyncApi expects a function references as a last parameter.

For example, to send command to Sabre Host and obtain response in an asynchronous way, one shall use code like presented below.

SrwAsyncApi.host('*M', hostAsyncCallback);

...

function hostAsyncCallback(rsp) {
   //handle response
}

List of SrwAsyncApi functions available in WebKit browser:

  • lock(callbackFunction)

  • lockWithTimeout(timeout, callbackFunction)

  • unlock(lockId, callbackFunction)

  • host(command, callbackFunction)

  • hostWithLock(command, lockId, callbackFunction)

  • sws(xml, action, callbackFunction)

  • swsWithLock(xml, action, lockId, callbackFunction)

  • sds(applicationId, subsetId, actionCode, callbackFunction)

  • sdsWithLock(applicationId, subsetId, actionCode, lockId, callbackFunction)

  • showInEmu(text, isCommand, callbackFunction)

  • executeInEmu(command, showCommand, showResponse, callbackFunction)

  • getHighlightFromEmu(callbackFunction)

  • sso(serviceProviderId, params, callbackFunction)

In case null is passed as a parameter specifying callback function, the Communication Framework Service will still be executed but the Red App will not receive response.

For sample usage of SrwAsyncApi see com.sabre.redapp.example.webkit sample.

  • Close API

Native Browser

end()

Webkit Browser

CloseApi.close()

close() function from Native Browser in WebKit browser must be invoked using CloseApi variable reference name, for e.g.:

CloseApi.close()

 

Custom Java handler classes accessible from JavaScript migration

There is new extension point named com.sabre.edge.platform.optional.webkit.js.handler for exporting Java objects to JavaScript objects.

In WebKit browser all Java methods must be invoked using JavaScript object variable reference that is defined in extension point as jsVarReferenceName attribute of handler element. Under this variable JavaScript object will be created providing access to Java methods from class defined in Java handler exported object (defined under handler class attribute). These methods must be not overloaded, receive as parameters primitive types or strings and return also primitive types or strings.

In Browser it was possible to pass arrays as a parameter. In WebKit browser passing and returning json as a string is recommended instead of passing objects or arrays.

Native Browser JS function definition:

<extension
         point="com.sabre.edge.platform.optional.browser.js.function">
      <function
            class="com.sabre.redapp.example.browser.service.WelcomeServiceClientFunction"
            name="welcome">
      </function>
</extension>

Analogue WebKit browser JS Handler definition:

 <extension
          point="com.sabre.edge.platform.optional.webkit.js.handler">
          <handler class="com.sabre.redapp.example.webkit.extensions.js.WelcomeService" jsVarReferenceName="welcomeJava"/>
    </extension>

In WebKit browser WelcomeService Java class is a POJO not extending any mandatory classes in contrast to WelcomeServiceClientFunction class which must inherit AbstractServiceClientFunction class and provide implementation mandatory abstract methods.