Posts about Java

Unicode Properties Files in IntelliJ IDEA

November 16th 2018 IntelliJ IDEA Java

In Java, .properties files are by default saved in ISO-8859-1 encoding. Since many languages use characters not included in this encoding, these characters will need to be expressed using Unicode escape sequences. Fortunately, IntelliJ IDEA can automatically handle conversion between the Unicode literals and their corresponding escape sequences, but the feature is not enabled by default.

Handling Empty POST Response in Hippo CRISP

October 19th 2018 Hippo CMS Java

One could argue that a JSON REST service should never return an empty body, but you might not always have a say in how a service you need to call will behave. Unfortunately, CRISP API in Hippo CMS throws a NullPointerException if the response body is empty.

Jackson ObjectMapper Config in Hippo CRISP

October 12th 2018 Hippo CMS Java Spring

The recommended way for integrating external services in Hippo CMS is the CRISP API. The official documentation provides detailed enough instructions for installing, configuring and using it. However, when I needed to customize the default Jackson ObjectMapper, it wasn't all that obvious how I could do it.

Initializing Log4j MDC in Hippo CMS

October 5th 2018 Hippo CMS Log4J Java Spring

In Log4j, Mapped Diagnostic Context (MDC) can be used to provide additional context information for every log message. In server applications it will usually be initialized for every request in a filter. In Hippo CMS, a custom valve must be injected into the request pipeline for that purpose.

Implementing Basic Authentication with CXF

September 7th 2018 Apache CXF Java

Generating the proxy client classes for a web service is only the first step. While the official documentation includes a basic sample for invoking a method on the web service, I had a hard time finding any guidance on how to pass in the credentials for basic authentication.

Code Generation with Maven CXF Plugin

August 31st 2018 Apache CXF Maven Java

Apache CXF is a common choice for calling SOAP web services from Java. It's most convenient to use when you generate proxy client classes from the web service WSDL file. There's a command line tool available for that but if you don't want to put the generated sources in source control, you'll probably prefer the Maven plugin.

Linking a Document to a Hippo Component

March 9th 2018 Hippo CMS Java

Most built-in components in Hippo CMS have a link to one or more documents as they are designed to render the CMS content documents. Sooner or later you'll want to achieve that with your own custom component as well.

Web Component Component for Hippo CMS

March 2nd 2018 Hippo CMS Web Components Java

As a part of getting acquainted with Hippo CMS I took on the task of creating a custom Hippo component for including a Stencil web component in a portal page using the CMS editor. I based my work on a similar component I found on GitHub for a Polymer web component.

Tree Fractal

August 3rd 2001 Java

Tree Fractal applet interactively demonstrates how easy it is to construct interesting images by adjusting the fractal parameters. The archive contains complete source code, a jar archive with compiled classes and a HTML page for viewing in a browser.

Java Classes

February 3rd 2001 Java 3D Java

There probably isn't a computer user out there who hasn't heard of Java before. The language is already shipped with many ready to use classes and every release has more of them. I have written classes for some common tasks myself and you can download them from here for free.