Skip Navigation

com.sabre.redapp.example.webkit Sample

The com.sabre.redapp.example.webkit sample includes the following functionality:

  • WebKit browser technologies that create a website with a custom WebKit browser editor implementation and Java code. The editor is rendered as a tab in Sabre Red 360. The sample classes are ExampleBrowserEditor, ExampleFocusOrOpenEditorHandler and WebkitBrowserWithContentEditor. The web app uses an URL from file using ConfigService. The WebkitBrowserWithContentEditor class loads provided HTML content instead of loading it via URL.

  • Webkit Browser technologies that create a webpage app in an editor with a default editor implementation. The default class that implements this editor is com.sabre.edge.platform.optional.webkit.editors.DefaultWebkitEditor. This simple web page uses extension points in plugin.xml, without Java code.

  • Browser technologies that create an app with a default view implementation. The default class that implements this view is com.sabre.edge.platform.optional.webkit.views.WebkitView. The view app, which is a Red App, uses OSGi communication services to get PCC and EPR information from the emulator. This app is dependent on an active emulator session in a work area. Extension points in plugin.xml without Java code create a view and embed a web page app into a browser.

  • Simplified Communication Services API usage

  • ConfigService retrieves plug-in specific properties to display a URL in a browser. The extension point implements this functionality.

  • Event listening for EMU_COMMAND. The event listener and command are registered in redapp.xml.

  • A mechanism that automatically unpacks and copies resources from a plug-in to Sabre Red 360 with the plugin_resources variable for the url. The extension point com.sabre.edge.redapp.pluginresources in plugin.xml sets auto override to true for basic.html and cfcommunication.html. These files are automatically unpacked and copied whenever this sample plug-in is run.

  • Authorization to multiple Communication Framework services in a redapp.xml file.

  • The contact details extension points in plugin.xml. To see these details, choose Contact us > Application Vendor Support in Sabre Red 360.

Running the Sample

Steps to run sample:

  1. In Eclipse, import the com.sabre.redapp.example.webkit plug-in into your workspace and add it to your run configuration.

  2. Launch Sabre Red 360 from your run configuration, and log in with your CERT Sabre ID.

Custom Browser Editor with Basic Java and Browser Technologies

  1. From the Tools > Other menu in Sabre Red 360, choose Sample Webkit Browser Editor.

        The following figure displays the web page in an editor within Sabre Red 360. If web page is not displayed, please make sure that you have properly set-up proxy in login window.



Default Implementation of a Browser Editor without Java Code

  1. From the Tools > Other menu, choose Simple Webkit Browser Editor.

        The following figure displays the web page in a tab.


Communication with a Web App and Sabre Emulator Using OSGi Services

  1. Use your Sabre ID to log in to a Sabre PNR work area. Choose Open Webkit Browser OSGI Communication View from the Tools menu.


        After you click the Get PCC and EPR button, your data is returned in the view, as shown below.


Event Listening

  1. To use the functionality that shows event listening, send any command starting with *A in the emulator.



Communications  with SRWRuntime from a Web App

  1. From Tools, choose Open Webkit Communication Framework View. This opens the CF Communication Webkit View.

  1. Send any command to the host.


        After sending the command to host the CF Communication Webkit View displays the response.


Simplified API View

There is a view called Simplified API View, which demonstrates how to use simplified API from JavaScript. The following are presented:

  • Execute/Show in Emulator services

  • Host Communication service

  • Asynchronous Host Communication service

  • SWS service

  • Welcome - the sample service, demonstrating how to define Java methods accessible from JavaScript code

  • Single Sign-On service

  • EmulatorHighlightExtractor service

  • Closing the active browser editor or view

  1. To open, choose Open WebKit Simplified API View from the Tools > Other menu.

  2. Type a command or SWS request in the appropriate part and click the button to display the response.


Custom Browser Editor with provided content

  1. From the Tools > Other menu in Sabre Red 360, choose Webkit Browser Editor with content. This sample also presents onbeforeunload event working in an editor.

OnBeforeUnload Webkit View

  1. From Tools, choose OnBeforeUnload Webkit View. This opens the Webkit View which shows onbeforeunload event working in a view.