JBoss Undertow is pulling me in … :o)

I am very impressed as I am trying out the various code examples for Undertow, a kick-ass, light-weight yet powerful, ultra-easy-to-embed HTTP and Java Servlet engine.

One of my side projects requires an embeddable yet feature-complete Java HTTP engine with low memory footprint and a simple straightforward API. I dismissed Tomcat, briefly considered Jetty, found Winstone too old and unmaintained, simpleframework not well-enough documented, vert.x and netty a little too much for my purposes and/or too complicated, so that a few weeks ago I had actually started to clone and refactor NanoHttpd.

The NanoHttpd refactoring was a great learning experience, but it certainly felt like I was reinventing the wheel in the form of a cute and mobile but slightly rusty foldable unicycle. ;o) – no offense please, nanohttpd developers

Then I found out about Undertow. The author Stuart Douglas is now officially my hero. What an awesome job he is doing! The server meets all of the above mentioned requirements and is apparently also comparatively fast. No wonder it is the HTTP engine used by Wildfly, the new JBoss AS.

Anyway, if you want to try yourself, I’d go with version 1.1 final at this time, i.e. this in your Maven pom.xml:

<dependency>
    <groupId>io.undertow</groupId>
    <artifactId>undertow-core</artifactId>
    <version>1.1.0.Final</version>
</dependency>

I decided to pretty much ignore the documentation section of the undertow.io website for now, as it is still for version 1.0 and the API has changed – improved, I guess – since then. It seems to me, that at this point the core code itself and the usage examples are the best documentation for version 1.1. Both are Maven modules of the undertow github project.

By the way, if you are wondering why the project has no issues section on github: The issue tracking is done in the JBoss Jira.

Using sipgate.de on Linux with Linphone SIP client

Note: This is a follow-up blog entry to yesterday’s post about using the Zoiper SIP client on Linux. Linphone works comparably well so far and if I won’t come across any issues, I will recommend Linphone, since it is fully Open Source, which future-proofs is existence and allows others to contribute and improve the software better than for a closed-source product like Zoiper.

Linphone is a GPL licensed SIP client (“softphone”). It has been around since 2001 and is actively developed by the French company Belledonne Communications.

As the name suggests, the software was first developed for Linux but has gradually become truly cross-platform, now supporting Windows, MacOS, Linux, Android, iOS, Windows Phone 8 and most recently a web edition. For most operating systems, simply visit linphone.org and follow the download and installation steps indicated there.

Users of GNU/Linux distributions like Debian, Ubuntu, etc, install the distribution package through their favorite package manager. On my Debian stable (“wheezy”) I did this today:

sudo apt-get install linphone

Then I started up Linphone from the XFCE Start menu, where it is listed in the “Internet” submenu. I canceled the account setup wizard because it didn’t seem to work for me, disabled Video in the Options menu because I am not planning to use it yet, then selected Options – Preferences – Manage SIP accounts and configured my sipgate.de account like this:

Your SIP identity: sip:3998984@sipgate.de
SIP Proxy address: sip:sipgate.de

Screenshot

linphone-sipgate-account

Note that “3998984” is my sipgate.de SIP account name, so you have to substitute it with yours, but note that it is usually not the same as your sipgate.de web login username.

After this initial setup, I successfully tested the account and my headset by calling the sipgate.de test number 10005, which works very similarly to the Skype test call feature.

For personalized config information you can log in at sipgate.de and consult the “Konfigurationshilfe“, selecting one of the Linphone entries from the softphone device lists. I have a sipgate.de basic account, so if you are on a different plan, details may vary slightly.

If this blog post was helpful and/or if something seems inaccurate, please leave a comment. Happy telephoning …

Using sipgate.de on Linux with Zoiper SIP client

I use sipgate.de for international phone calls, using a Grandstream HandyTone IP-to-analog adapter installed in our house, but also using a SIP-capable “softphone” application.

Update: Open Source SIP client software like Linphone, SFLphone, Ekiga or others are preferrable to the below mentioned closed source applications. I successfully use Linphone now, which is also the only Open Source softphone that is explicitly listed by sipgate on their supported devices page.

Below is the original post about Zoiper, which might be of interest if you for some reason don’t like Linphone.


On Windows I have successfully used the PhonerLite freeware (binary download at no charge, proprietary licensed closed-source), which is not available for Linux.

But today I found out, that Sipgate also recommends a SIP client called Zoiper, which is available for Linux. It is also closed-source freeware. But at least – unlike Skype – the installer package has support for 32bit and 64bit Linux systems and the company behind Zoiper seems to develop for all target platforms equally (Android, iOS, Windows Phone 8, Windows, Linux, Mac, Web Browsers).

The Zoiper website has detailed step-by-step installation instructions. To summarize, the installation works like this, assuming the downloaded file is Zoiper_3.3_Linux_Free_32Bit_64Bit.tar.gz :

tar xvzf Zoiper_3.3_Linux_Free_32Bit_64Bit.tar.gz
sudo ./Zoiper_3.3_Linux_Free_64Bit.run

I specified /opt/zoiper as the installation directory.

Then I added an account like this (my SIP account username is 3998984, this is not the sipgate.de web login user name):

zoiper-sipgate-config

The audio devices (speaker, mic) can be configured and tested using the “Audio wizard”:

zoiper-audio-wizard

How to report profiles of LinkedIn spammers

If you use LinkedIn discussion lists – like the “Java Developers” one that I frequently participate in – you might have seen posts about “Fast Loans” and other annoying commercial messages that are unsolicited, way off-topic and commonly referred to as spam.

A first step is to point out to the poster, typically by simply commenting on their posting, that each LinkedIn group has a “Promotions” section and kindly ask them to delete the spam and to select the “Promotions” category accordingly in the future. Sometimes this friendly approach actually works.

LinkedIn has an official guideline for “Flagging an Inappropriate Discussion or Comment in a Group“, but often the recommended flagging of individual posts leads to no visible change and quickly gets tiresome, since it will only temporarily hide the flagged content and – in my experience -leads to no repercussions for the spammer themselves.

If you are lucky, your LinkedIn group has active owners who you can contact and they might block the spammer and/or even lock down the group to “members only”. But unfortunately, group owners often do not have the time or motivation to do this kind of policing.

So if a spammer ignores your friendly requests and continues to fill your favorite discussion group with garbage and you have run out of other options, consider reporting their LinkedIn profile like this:

- Go to the LinkedIn profile of the spammer (by clicking on their name)
- Use the dropdown arrow of the blue "Send [Firstname] InMail" button
- Select "Block or report"
- Click the option "Report [Firstname Lastname] so that"
- For "Flag profile as" select "other"
- In "Details" put this, replace LINKEDIN_GROUP_NAME accordingly:

This profile has been repeatedly used to post unsolicited, completely off-topic, commercial messages on LinkedIn groups like ‘[LINKEDIN_GROUP_NAME]’. The owner of the profile has so far ignored all requests to stop the spamming. Please take appropriate actions.


- Then click "Continue" button on the bottom
- Agree to the prompt "Are you sure you want to report [Firstname Lastname]?"

Finally you should see a notification:

“Thank you. The profile has been flagged for review by LinkedIn Customer Service.”

Optionally, copy that notification text and paste it into a comment / reply to the spam posting that caused you to report the person. That way the spammer will notice that (and how many) people reported them.

Is JSP an unsupported deprecated part of JEE ?

Recently, someone claimed that Java Server Pages (JSP) is an “unsupported”, kind of “deprecated” technology and that Java Server Faces (JSF) is the superior current standard.

I responded that JSP is a solid base standard, not deprecated, just not much advertised anymore. In combination with JSTL core logic tags it is still a reasonably powerful option, suitable for straightforward request-oriented web applications.

For example, JSP tag files (pure JSP based tags, no Java coding required) are a great templating feature for easy view structure reuse that many Java web developers don’t even know about because it was only added in JSP 2.0 – as part of JEE 1.4, when newly released JSF was getting all the hype.

JSP is “stable” in the sense that no significant features have been added in recent years. It is hard to find information on what was actually new in JSP 2.3 versus JSP 2.2. Some might say that it is borderline unmaintained because of this lack of changes. Others might just like it as is.

I think JSP is for web applications sort of what the JDBC API is for persistence, whereas JSF is sort of what the JPA standard is: More elaborate, higher-level features, multiple implementations of the standard by different vendors, added (sometimes nerve-wracking) complexity.

On the other hand, the JEE documentation side of things looks pretty bad for JSP (and ironically also for JDBC):

The JEE 5 tutorial still had a full long chapter about all aspects of JSP.

The JEE 6 and JEE 7 tutorials don’t have those chapters anymore and mention JSP only in passing. The documentation focus is clearly on JSF.

The omission of JSP from those JEE tutorials lead some folks on stackoverflow to ask “Where’s the official JSP tutorial” with some interesting answers.

Regarding non-“deprecation” of JSP, please note that the JEE 7 technologies page clearly lists JSP 2.3 as part of the JEE standard.

The reference documentation for JSP 2.3 is the detailed spec of JSR 245, version 2.3, maintenance release 2, available as PDF from the JSP site.

The JSTL 1.2 spec is also available as PDF from its JCP page.

Side note: Maven Central has a javax.servlet.jsp-api artifact, with most recent version strangely marked as 2.3.2-b01, as if it was a “beta” version.

So in conclusion: Certainly there is no buzz around JSP, rather complete silence. You can call that silence a symptom of death or see it as a sign that there is no need or interest to change this still widely used technology anymore.

How does Java’s Object.wait() really work?

Recently, I came across a question whether Object.wait() uses an “infinite loop”.

I didn’t know the answer, but since the JDK is Open Source, I thought I could at least find out where the code is and look at it.

So for example for JDK 7, these are the steps through the OpenJDK sources:

  1. In Object.java wait() calls the native method wait(timeout) via wait(0)
  2. The native code for wait in Object.c actually uses JVM_MonitorWait.
  3. The JVM wrapper method JVM_MonitorWait calls ObjectSynchronizer::wait.
  4. ObjectSynchronizer::wait calls wait() on an ObjectMonitor.
  5. Finally ObjectMonitor::wait does the real work.

I don’t fully understand that code, but I certainly don’t see an infinite loop in there. :o)