WebSocket is a communication protocol providing a bi-directional communication channel between client and server. It allows us to directly send a message to the clients whenever something changes on the server side and we want all clients to be notified. Let’s see the skeleton for a simple WebSocket example in Java. Continue reading WebSocket example in Java
In the past few weeks I was required to create a prototype for the frontend of a project and because the focus is only on the frontend, I’ve chosen Jetty to create a simple mock server that would respond with simple JSON messages or stream some image files. I also use Jetty to serve the static files, like static images, CSS, JS that I am continuously modifying while developing the new frontend. Because I am developing on Windows, I have run quite soon into the file locking problem.
Do you usually ask questions during an interview about the computer and other hardware you will be using if you get the job? And about the software? Well, I didn’t, and after using IntelliJ Idea from the beginnings and never having less than 8 gigs of RAM in my machines, I woke up with a laptop with 4GB RAM and Eclipse.
While working in Ruby at my previous workplace we were required to write unit tests using RSpec and end-to-end tests using Cucumber and Watir webdriver. I wasn’t a big fan nor am I today of writing tests, but for some reason I just loved Cucumber. We wrote them together with the members of the QA and it was fun, because we both were thinking about all the possible cases to test and not about the way the tests were going to be implemented. Furthermore, it was clear for everybody what I wanted to test, as the scenarios were written in natural language.
Wink is the JAX-RS implementation from Apache. I have never used it in a real-life project, but I thought it would be a good idea to create a small, dummy example as I did with RESTEasy and Jersey before just to see how easy/hard it is to get started with it.
Previously I have published a small example of a RESTful Web Service in Java using RESTEasy and JBoss. Today I have created another example, which uses Jersey and may be deployed on Tomcat…
Implementing RESTful services in PHP or Ruby was very easy, I love its simplicity compared to SOAP. But implementing a RESTful service for the first time in Java has caused me a bit of a headache. In the beginning I was quite confused when it came to JAX-RS specification and the different implementations (Jersey, RESTEasy, …), but then it’s so easy, I don’t know why I have wasted so much time figuring out what I needed…
A few days ago I had a challenging task in Java: I had to add a custom header to my SOAP request using Axis 2. But the custom header had to be passed as a HTTP header, not in the SOAP Envelope, since it was used by a Filter and it had nothing to do with the rest of the request. The Filter simply gets a ServletRequest, gets the extra parameter from the HTTP header and does something with it, without having to parse the SOAP Envelope. It’s not that hard to do, there is documentation on this issue, but because there can hardly be found a good example, one may waste several hours trying different solutions.