Friday, December 27, 2013

JSF: Passing parameters to JSF action methods from page directly, a nice feature of JavaEE 6+

One of the JSF 2+ nice features presented in Java enterprise edition JavaEE 6+, is that you can pass parameters to any action components action method like commandButton or commandLink components.
Based on that you can minimize the number of methods inside your managed bean.

In addition, to minimize many parameters to set inside the bean to be used by action to decide navigation logic, which reduce memory consumption if your beans in scopes greater than request scope.
How it works:
  1. Open your favorite IDE, I am going to use Netbeans 7.4.1. (Use any IDE that supports JavaEE 6 or 7).

  2. Create web project.
    File --> New Project --> Java Web (left pan) --> Web Application (right pan) --> Next.

  3. Name it whatever you like (JSFeatures for me)--> Next --> Server Glassfish4 --> Java EE 7 Web profile --> Context path "/JSFeatures" --> Next.

  4. From frameworks chose "Java Server Faces" --> Finish.

  5. You should have project structure like this:

  6. Right click on the JSFeatures project --> new "JSF Managed Bean". and its name and config like this:

  7. With the bean opened in the editor page, copy and paste the following code after package statement:
  8. Open the index.xhtml which is generated by default, and copy the following code and past it in your file:

  9. Right click on the index.xhtml then --> Run; you should see something like this:

  10. Click submit button and watch h:outputText value, its value should be "Hi there I am an action method."

  11. Now everything is working fine. Let us do the actual work I need to demonstrate.

  12. Change addNumbers() method signature to the following (without restarting the application server):
    1. Bean method:

    2. Then your button call to:

    3. Press the button and output text value should be:

  13. 13. Do it one more time:
    1. Bean method:

    2. Then your button call to:

    3. Press the button and output text value should be:

Note: the parameter could be with different parameters type not expected to be the same type, also method could return a value for navigation to other pages, in this example it returns null to be on the same page.

I liked this feature too much enjoy it, very helpful and handy, and happy coding.

1- JavaEE 7 tutorial (7.5 Navigation Model).

Tuesday, December 24, 2013

Oracle: ORA-00600 raised when creating triggers on 11g using JDeveloper or SQL Developer

While I was preparing my database migration script for my project to satisfy specific version requirements, and as usual test it against database before submitting it to QA team. I got the following error with each "CREATE TRIGGER":

It was a very strange behaviour for me, and I contacted my DB team to get help, and logged a support on Oracle Metalink. Because it always works previously on 10g but my new environment is 11g.

It is a bug in oracle and there are bugs logged for this issue:
  1. Bug 10174125
  2. Bug 10094416 is fixed in 12.1 release.


At the beginning of my script, I have added the following alter line:

And at the end of the script add the following alter:

Monday, December 9, 2013

Android: Boost up the Android emulator speed up to 400% on Intel based architecture

In my previous post How to inject Android compiled .apk package into its Device Emulator from the command line. I have demonstrated how to add your compiled .apk file to android emulator, from command line with adb command, included in ADT platform tools.

One of my friends commented:
"Are u really using the is very slow. Even on the fastest machines. I always use a real device."
From this comment, I have made some R&D about this problem, and especially this tools are developed by Google ;), and indeed they know about this symptom.

Also testing on real devices are very costly and time consuming process, as we have a variety of devices varies from multiple screen sizes, which are one of Android developer's worst nightmares. There are a huge number of different screen configurations of Android devices.

The great thing about using an emulator for development is that it gives you an opportunity to develop applications without having a real Android device. The default Android emulator comes together with the Android SDK and can be found in the "tools" folder.

So far so good, we have our coffee, but can we drink it? The answer comes about 5 minutes after we hit the "Launch" button. Go grab a coffee. Have breakfast. Come back. Wait another 5 minutes. Maybe even more.

In meantime, the default Android emulator is notoriously slow. So, what should we do? That is easy - start using a properly fast Android emulator.

Emulation vs. Simulation

If you are using Apple iPhone simulators, you will find that the iPhone simulator does not have the same issue as the Android Emulator.

One of the reasons for this is that it does not run a “real emulator”, because the CPU instruction used by the iPhone simulator is the same as the one used by the host (x86).

On the contrary, Android Emulator emulates a real ARM processor on top of an x86 processor. This is a lot of overhead.

At least for quick test and demonstration purposes, I do not need to emulate an ARM processor; I just need to be able to run Android and my application. The main objective before releasing an application is to find bugs and design imperfections.

Okay, it is slow. Then what can we do about it?

Let us go through steps to solve the slowness problem of Android emulator;

  1. First, let us delegate the rendering process to host GPU instead of overhead our CPU by this process, it will make it happy. Do it by checking "Use Host GPU" checkbox in AVD's edit window.

    The screen should now look better and be more responsive. That is because the CPU is happy to not dealing with the tedious work of doing rendering anymore. However, that is still not fast enough.

  2. Second we need to download Intel Atom (x86) system image for each Android version you need to use for testing.

  3. Third, download Intel x86 Emulator Accelerator (HAXM, for Mac and Windows only). This will enable virtual machine acceleration capabilities of the Intel CPU, from Android SDK manager --> tools. Or install it from Intel site.

  4. The SDK only copies the Intel HAXM executable on your machine, and it is up to you to install the executable.

    To install the Intel HAXM executable, search your hard drive for IntelHaxm.exe (or IntelHAXM.dmg on Mac OS X). If you left everything to default, it should be located at %Android_HOME%\sdk\extras\Intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe.

    Intel HAXM only works in combination with one of the Intel® Atom™ processor x86 system images.

  5. In order to be able to install the Intel HAXM, you need to have Intel VT-x enabled in your BIOS, otherwise you will get an error like this during install.

    Enabling Intel VT (Virtualization Technology)

    How do I enable Intel VT in your machine BIOS?
    1. Boot into BIOS.
    2. Select "Config".
    3. Select "CPU".
    4. Press enter at "Intel Virtualization Technology".
    5. Select "Disable".
    6. Press F10 and select Yes.
    7. Boot into Windows then shutdown the system.
    8. Boot into BIOS again.
    9. Select "Enable" - Intel Virtualization Technology.
    10. Press F10 and select Yes.

  6. After installation goes successful, edit your AVD and chose Intel® Atom (x86).

  7. Finally Hit okay, then lunch your cake and definitely enjoy the speed.
VIP Note:
You could say that this level of speed should be sufficient. That may be true, but an issue with the Intel x86 images is that you do not get Google Apps, they only come with ARM images. This is important if you are testing an app that uses GMaps, or Google Play Services.

Thursday, December 5, 2013

Android: How to inject Android compiled .apk package into its Device Emulator from the command line.

I am developing multi-platform (iOS, Android, Windows, and Blackberry) hybrid mobile application for fuel stations finder, I am developing on Adobe Dreamweaver CC, and using Cordova, and PhoneGap tools as well for compilation and final apk, ipa, exe binaries.

I am using Cordova for compiling the mobile application on both windows and Mac. Moreover, I want to test my compiled (.apk) application on Android ADT AVD emulator directly instead of opening ADT eclipse, then run emulator from inside.

Note: my unzipped ADT package on the following path on my machine "E:\Utilities\Android ADT bundle", it may differ on your machine.

If you face a slow Android emulator, please refer to this post "Boost up the Android emulator speed up to 400% on Intel based architecture".

The following are the steps to inject .apk file into the emulator directly to test it:

  1. Go to "E:\Utilities\Android ADT bundle\sdk", and run SDK Manager.exe, after it opens, choose Tools then manage AVDs.

  2. On AVD manager click on your android platform, then click start from right panel.

  3. Based on your machine speed, you should see the emulator up starting Android platform.

  4. After a while, the platform should be started and ready for usage.

  5. Click on application menu as illustrated in point 4 image, then app menu should open.

  6. Under your ADT/SDK folder point to platform-tools folder.

  7. Create new folder called apps, and copy your appName.apk (in my case Banzenty.apk) into that folder.

    Note: Apps folder creation is an optional step, you can past it into the directory directly, but it is for manageability if you have many apps to test.

  8. Open your command line tool cmd on windows, terminal on Mac, and go to platform-tools.

  9. With emulator running, run the following command to check that we have the correct device:

    if everything is okay you should see the following output

    List of devices attached
    emulator-5554 device

    Otherwise nothing appears just

    List of devices attached

  10. After we checked that we have the following emulator device attached run the following command to inject the app to platform.

    If app successfully installed then output will be on console as the following:

    212 KB/s (8756736 bytes in 40.265s)
    pkg: /data/local/tmp/Banzenty.apk

  11. And into emulator platform you should find your application installed

  12. Click on the application and test it:

Happy testing :) Enjoyed it share it.

Wednesday, December 4, 2013

JavaDay 2013: JCP & Adopt Kick off & What’s new in Java SE, EE, ME, Embedded world & new Strategy

"What’s new in Java SE, EE, ME, Embedded world & the new Strategy" and "Drive yourself, community with JCP & adopts to professionalism" sessions

I would like to share my successfully Java day story, and my happens by the response of my last event.

I have successfully ran a JCP Kick off session titled "Drive yourself, community with JCP & adopts to professionalism" 2 hours followed by a session titled "What’s new in Java SE, EE, ME, Embedded world & new Strategy" for also 2 hours, last Saturday (30/11/2013) in Cairo University.

What’s new in Java SE, EE, ME, Embedded world & new Strategy;
In this presentation, I have presented the history of Java EE from v1.0 to our latest Java EE 7.0, what is new and a brief introduction to each minor and major change to existing JSRs, and new JSRs with code to show simplifications and enhancements.

Also talked about our future Java EE 8 components alongside JDK 8 with major updates and JSRs, profiling concepts and more.

Lastly, I have explained the IoT concepts with demo. Intro to the importance of Java Embedded systems world. With intro to Raspberry Pi and dukePad.

Drive yourself, community with JCP & adopts to professionalism;
This is an overview presentation about JCP organization, its roles, process, and output. With a detailed explanation of each group role and their output. In addition, to encourage community to participate in JCP, and being valuable members and experience input to the community.

Agenda for both sessions:

The attendees almost was Professionals, Students, Assistant teachers in Faculty of computer science and Doctors as well.

The main comments I got from all attendees via feedback by the end of sessions, via mails, Facebook, twitter, Google+, and LinkedIn was very positive the information they got also the content. They encourage participating in JCP program that I will lead under EGJUG.

In addition, I got a request to arrange with faculty teacher assistants to hold workshops, in their faculties sponsored by university for their students and assist teachers to get hands on experience on new Java technology as they interested to make it a curriculum in the future semesters of pre-graduate students, so the student can be ready for the market with latest tools.

I really was not except such a response but thanks God it was beyond my expectations.

With the co-operation with EGJUG, I will lead the JCP program, and we have created a participation form, collecting information to be used for participant evaluations to join the Group. And it will be sent with session materials.

Saturday, October 19, 2013

JavaOne 2013 Rocks, and Java back to Glory days this year (Trip report)


Yeah late report, but I am back since fourth of October, and having a strong workload. I am working on Enterprise Hybrid mobile application for almost main four different mobile platforms (iOS, Android, Windows 8, BlackBerry) that will serve the Egyptians all over the country, because it is part of our National project for "Fuel subsidy management System" applications, This mobile web application is developed and supported by JavaEE 7 technologies and hosted on Glassfish v4. This application should release by the end of November ISA.

However, I can not miss the opportunity to express my exciting and appreciation for this year JavaOne 2013, therefore I needed to catch up with all the things happened with me, which had been on hold for the whole conference days. It was the busiest time of the year for me.

This is the fourth time attending and the second time speaking at JavaOne 2013. This year the conference sessions, events, demos, sponsors, people, speakers, JCP was rocking out, It is suffice to say that this conference has been the most diverse of the Oracle JavaOne conference that I have ever attended.

The following are some pictures I have taken from airplane to North pole of the earth and my Lovely San Francisco:

Of course, the most important tracks for me were Java EE, Java SE, mobile, and embedded, because of my JCP JSRs participations and Adopt-A-JSR program participation that I manages under MoroccoJUG and EGJUG.

I delved into all JCP sessions and events, and a few lot of java SE 8 session incredibly relevant to my adopt-OpenJDK work and future use.

Here is some Socialization with great people I have met at JavaOne and I am so happy to see them and the community people there, in no particular order and as I remember (Sorry if I forgot anyone):

Patrick Curran

Gil Tene

Heather VanCura

Sander Mak

Naoko Hamamoto

Nicole Scott

Markus Eisele

Ben Evans

Dan Sline

Helio Frota

Tori Wieldt

Chris Richardson

Talip Ozturk

Olena Syrota

Stephan Janssen

Mark Reinhold

Richard Warburton

Brian Goetz

Sander Mark

James Ward

Geertjan Wielenga

Yara Senger

Johan Vos

John Yeary

Martijn Verburg

Sharat Chander

Venkat Subramaniam

Brian Oliver

Simon Ritter

Regina Better

Julien Ponge

Adam Bien

Justin Lee

Bruno Souza

Arun Gupta

Ed Burns

Antonio Goncalves

Badr Elhouari

Reza Rahman

Nicolas De Loof

Fabio Velloso

Mike kith

Bruno Borges

Stephen Chin

Kevin Farnham

Sharat Chander

Otávio Santana

and people++ :)

This is a very brief trip report for a complete week of JavaOne 2013 in San Francisco.

JavaOne Keynote

I would like to begin by talking about the JavaOne keynote that was held on Sunday morning and took place back at the familiar Moscone Center for the first time since 2009! For 3 hours long. Nevertheless, this is the most amazing, exciting, well managed and knowledgeable keynote I have ever attended for JavaOne.

The keynote was divided into three parts; the first part was the "Oracle java strategy and the future of Java keynote", the second was "Java and its related ecosystems technical keynote", while the third was " IBM Keynote: Java Flies in Blue Skies and Open Clouds".

The second part was very cheerful with a lot of code, demos, and the owners of the technology.

The third part was very important to me because of cloud, and to see IBM cloud strategy, as my book titled "Getting started with Oracle public Cloud" for Packt publishing, was published during the conference days and it regards how to start and develop on Oracle public cloud.

The Keynote deserves to be watched (do not miss it out, a lot of information you will gain (IoT (internet of Things), Embedded, Raspberry Pi, JavaSE 8, 9, JavaEE 7, 8 and beyond), to re-watch it again please visit this link (JavaOne 2013 keynote).

JCP (Java Community Process)

As JCP member, it was very important to me attending and contributing in all JCP related sessions and events and socialize with community members. In addition, because of my activities in leading the participation of Egyptian developer's community for all upcoming JCP, and any java related programs under EGJUG.

I almost attended the most of the JCP sessions and events, but out of luck because I missed out the Community keynote on Thursday 26/10/2013.

The JCP Party: 11 Annual award winning event

It is a year since becoming a JCP member, and works under MoroccoJUG umbrella for managing adopt-a-JSR program activities.

But I was surprised to got two nominations from the community this year:
  • JCP Member/Participant of the Year

    Mohamed Tamen
    Mohamed is one of the most popular leaders in software industry in Egypt. He is very professional due to his long experience and loyalty in his work, with 11 years of experience in Java industry. As a JCP Member, he worked on many JSRs especially the Java EE 7 JSRs, and is a member of the Adopt-A-JSR, Adopt OpenJDK, and FishCAT programs. You can view his blog ,which is helping a lot of people around the world with news of Java EE 7.

  • Outstanding Adopt-a-JSR Participant

    MoroccoJUG and EGJUG, Mohamed Tamen, Boutaounte Faissal
    For adopting JSR 339, JAX-RS 2.0 specification, along with many other JSRs. One JIRA issue filed by Morocco JUG on JSR 339 was classified as a "release-stopper". A quick JIRA search using the "adoptajsr" tag shows that most of the JIRA issues have been created by MoroccoJUG members. Several presentations and source code have been organized by these groups. Mohamed presented sessions about the upcoming technologies to widen the range of users in the future, especially Java EE 7 JSRs and spreading of community progress and contributions that make us encouraged to participate. Mohamed sent a clear message that Africa is here and is full of talented people who are willing to take it to the next level. Mohamed was responsible for translating an Arabic Adopt-a-JSR web page to allow more Arabs to participate.

The event was held in Hilton San Francisco, Cityscape at Monday evening. During JCP 11 award winning party, they announce the winner's names, and while I was eating, I heard my name that I won the "11 annual award winning for Outstanding Adopt-a-JSR Participant of the year." it was another surprise for me. vist link for winners and their nominations.

Here are some JCP interview questions and my answer:
  1. What can others learn from your experiences?

    There is no limit to knowledge. You have to keep learning as long as you can breathe. Also, accept your circumstances and do not waste your precious time trying to find someone to blame.

    Academic studies help making you think in a better way and gaining a wider knowledge base, so, do not study to pass for the certificate, study to learn.

    I have worked in development since late of 2001 with many technologies and programming languages, especially Java and its related ecosystems, which is my best choice, when I coding with Java, I feel coding the Architecture….

    I worked with Java EE, SE, JavaCard, and ME for more than 11 years. While currently, I am holding two positions one as a Business Solutions Systems Architect & design supervisor and Java Team leader, at big financial services company in Egypt, affecting all the country by building solutions affecting Egyptians day, providing more facilities to businesses and enhancing the economy. I share requirement gathering and business discussions.

    I care a lot about the quality of my product, starting by the architecture design, considering many concepts like Scalability, Extendibility, maintainability, security, performance as non-functional requirements, for Service Orientated Architecture, project oriented Software, Client / Server Software, Distributed Component-Based Software, Concurrent Real-Time Software, Software Product Lines, Mobile Development, and Framework Software's.

    I have built a lot of projects in financial services, accounting, market products, mobile, banking, governmental, truism, and utility industries.

    I am Architect, designer, speaker, trainer, consultant, technical reviewer, co-author, and photographer.

    For more information about projects I have developed, and specific technical tools I am using and experiencing, please visit my LinkedIn profile and

    Therefore, you are welcome to contact me anytime for any assistance and consultation.

  2. What helped to make your work significant to the community?

    I am passionate to Java, and I really love it and feel fun the way I code it, and seeing it growing day by day, as if it was my kid. I am in a relation with it since Java 1.0 was born.

    My wide background especially academic, professional career, business consultation, and daily reading, taught me a lot of business and ideas that make me think of a lot of cases needs to be covered in next JEE especially JEE 7 and beyond, such as communication speed and real time notifications problems, integration, security, batch applications and caching.

    Therefore,I have decided to contribute in the future of java and it begins with JEE 7 Umbrella and JCP member, and my contribution was focused on the following JSRs and projects JSR339 (JAX-RS 2.0), JSR356 (Web Socket 1.0), JSR353 (JSON Processing API 1.0) and I have engaged in FishCAT program which is a GlassFish Community Acceptance Testing program. And I worked a lot with and under MoroccoJUG members and its umbrella.

    I spoke at many conferences locally and worldwide for spreading the concept of adopt-a-jsr, adopt-openJDK and contribution benefits that will gain from and affect developers from their contributions. Alongside evangelizing JEE 7 and JDK 7,8 new JSRs and APIs in sessions delivered at JavaOne 2012, JDC Egypt 2013, Tunisia JUG Day 2013, Ukraine JEEConf 2013, JavaOne 2013 this year and will at jMaghreb 2.0 7-8/11/2013.

    Spreading the contribution and statistics of our community work on my blog to show our significant progress to the Specification and JSRs. Also helped to translate adopt-a-jsr wiki page to Arabic.

    I become an EGJUG member now, and I am responsible for forming and building a team for future contribution to the Adopt-a-jsr, adopt-openJDK, and any program could open in the future and indeed JCP activities.

  3. Were there guiding principles that were of particular value?

    My strategy is planning, Learning, Watching, Sharing, Writing, Teaching (if any), and be Pragmatic.

    Actually, this is what I am doing all the time and continually trying to improve it.

    Planning is the most effective way to manage your precious time. I plan my projects, tasks, priorities, and especially my year. Every beginning of the year, I begin by categories my tasks such as sports, social participations, knowledge, certificates, new tools to be learned, technologies, hobbies, religion … etc.

    By the time you will reach your goals, so do not be disappointed if you did not achieve them all at the beginning. Believe me, one day you will get more from what you actually planed for, it simple because you already knows how to manage your time.

    Keep learning new stuff, things not related to your field, at least monthly book to be finished or more based on your capabilities. to wider your knowledge base, and doing a lot of R&Ds, see the market needs and what is new tech/tools to learn. Learn from your previous experiences but try learning from others as well.

    Watching your acts, doings, behavior, and you need to find couple of people who you admire for some reason.

    Then you take a notebook and write down what it is that you like about them. Their discipline, their passion, their dedication, how they talk to people, how they dress, their idea about leisure and enjoying spare time… Whatever it is that you like. Not the person as a whole, but specific part of his behavior, which you like to mimic.

    Finally, you take the notebook and pick which of those values you will embed in your own life. Which of those experiences you will try to bring to your life too. Prioritize, set, and go.

    Always dedicate some time just for thinking, bring back the things that make you improve your experience and life.

    Share, write, and teach what you have learned, by conducting sessions, talks, workshops and spread the knowledge, to make you an effective member to your community, and indeed you will learn a lot from others questions, and experiences which will open the doors for you to know more and more.

    Be pragmatic and practical do more practice, writing code and participating to other projects, read others code, and believe me "In theory, there is no difference between the practice and theory. In practice, there is".

  4. How do you feel about being nominated for this award?

    Wow!It is a big honor, just being nominated for such an award makes me so proud and appreciated. In addition, I fell that my work is appreciated.

    But also, I've felt that I have to do more and more in order to deserve and keep such an honor.

Trip Events

I faced a challenge is to balance activities between the two conferences events happening. I want to catch up with Product Management, VPs, and CEOs of other Oracle partners, but indeed, I am also interested in meeting the peers in the Java space and socialize with them.

As I have said before, this trip was the busiest one I ever attend. Beside my JCP contribution, talks, session I have also some contribution in Oracle OpenWorld events, as I am a board member of the Oracle EMEA Architect Club, and my company is a big partner therefore I am representing my company in Oracle Partner dinner.

Here are the other Oracle events I have attended

  1. Oracle Eastern Europe, Middle East and Africa Partners Dinner at Oracle OpenWorld 2013 was in Sep 24, 2013 from 07:00 PM – 12:00 AM, at Terra Gallery 511 Harrison Street San Francisco 94105.
  2. EMEA and Oracle Architects Café at Open World. Architects Café Jasper’s Corner Tap & Kitchen, 401 Taylor Street, San Francisco, CA, USA. Monday 23 September 2013.

My Session materials

Below is the talk, which I have delivered at JavaOne 2013 and provided links for presentation, code, and question that I have been asked during the session as I remember.

My own session, started with 65 people about 10 days to go, then a couple of days later, it had 95 days, and then eventually on the day it was 108 pre-registrations.

Talk; True Real-Time Applications with Java EE 7 (A Hack Session) [TUT1805], Was Wednesday, Sep 25, 10:00 AM - 12:00 PM - Parc 55 – Divisidero.

I have begun my take with introduction to community (JCP members, adopt-a-jsr group) efforts that made JavaEE 7 possible, and a brief introduction about JCP and how it was governing the standardization and covering all JavaEE 7 JSRs and TCKs as well and the reference implementations of each JSR.

Then I have divided my talk into two parts, the first part was about WebSockets and what is behind this protocol and how it works. With a real case study to compare it against the HTTP protocol. Afterward I gave an Introducing to JSON data type, and finally shows how we are supported those technologies in JavaEE 7.

The second part was demo, coding and testing of two projects, real time board planning, and Runners championship monitoring application.


Session Code

All code is part of Adopt-A-JSR organization under github project; you can fork/clone the project from the following link.

Some Session Questions

It was question/answer driven session, it was very active session, and here are some of the questions that I have been asked during the session.

  • Question: Why now implementing WebSockets while there are many implementations there?
    Answer: The main aim of JavaEE 7 is being productive platform, embracing HTML5 APIs, and standardizes the technology as well and this is JCP rule.

  • Question: Why we need websockets, while we can achieve the same results using polling or long polling?
    Answer: All of these hacks described are HTTP protocol specific, and every request and response abuse the bandwidth and latency of the network channel, rather than this it is not real time.

  • Question: What is the protocol of WebSocket?
    Answer: Websocket uses ws like http for normal communication, and wss like https for secure communication.

  • Question: Why we do not use SSE server sent events?
    Answer: Because server sent event is unidirectional and meant, is used by the server to notifies the clients and not vice versa, so it is not real time.

  • Question: Where originally Websockets come from?
    Answer: Websockets is originally part of HTML5 APIs, and Internet Engineering Task Force (IETF) maintains the protocol, while W3C maintains the JavaScript API.

  • Question: In TCP level each frame is about 1k in size, so how it will reduce the data bandwidth?
    Answer: As we have seen by the real case provided how the WebSocket reduces the network bandwidth compared to HTTP, because there is no need for verbose request/response paradigm it is only when making the handshaking. Rather WebSocket uses data framing with message header equal to fixed 2 bytes size while the message data is the remaining of the frame.

  • Question: We send a request, so where is the response?
    Answer: Websockets is a data messaging technique, any endpoint can send message to the other, and it is up to the client/server to send response back or not, based on your business logic.

  • Question: We send a request to the server, then how we can process the response and when?
    Answer: You process the response data on the client using onMessage(data) method, and it is called asynchronously by the browser when server send a message.

  • Question: What about the security, is it supports proxies and SSL?
    Answer: Websocket support SSL, and proxies. Supporting SSL by using wss protocol like https, and it is defined in web.xml the same as any other component in the system.

  • Question: How session is maintained?
    Answer: Web server maintains the client session connected to the endpoint in form of Session class.

  • Question: Can I connect to different WebSocket endpoints from my client at the same time?
    Answer: Sure, you just need new instance from your client and passing new endpoint URL.

  • Question: What are the data types supported in WebSocket messages?
    Answer: Websocket supports String, binary, and primitive data types as well.

  • Question: What is the difference between using JSON and XML in integrations?
    Answer: JSON is a lightweight data type for integration rather than XML, there is no need for tags, it is human readable, finally it is String data type, it covers all required data schema, and there are a lot of implementation out there.

  • Question: Is JSON-P APIs support data binding like its counterpart JAXB?
    Answer: In the current release no, but it is in our plan as important feature in upcoming releases.

  • Question: How we can use this technology to know about the server status?
    Answer: You can use Ping/Bong message to check if your server is alive or not, also you can use SSE for heart beat check.

  • Question: As you are working in big financial institution, where do you fit this technology under your projects?
    Answer: I am migrating my all agents polling checks to use WebSocket. also in my current Mobile web/Hybrid application for real-time communication with the customer to inform him/her by current fuel station fuel balance and their cards transactions balance, also in real time feedback/support by the customer support team.

There are more but those what I can remember until now, if there are any new question I will update the blog.

Feedback and comments

Pictures of the trip