Home » Java (page 602)

Java

Protect a REST service using HMAC (Play 2.0)

We have HTTPS, what more do we need? When you talk about security for REST based APIs, people often point to HTTPS. With HTTPS you can easily protect your services from prying eyes using methods everybody is familiar with. When you, however, require an additional level of security, or HTTPS just isn’t available, you need an alternative. For instance you ...

Read More »

The Strategy Pattern

java-interview-questions-answers

In a recent blog on I received a comment from Wojciech Soczy?ski about how the “strategy” pattern can be used to enforce the Single Responsibility Principle (SRP) when using Tell Don’t Ask (TDA). At some point I plan to discuss this further, but first thought that it would be a good idea to define the Strategy Pattern using the ShoppingCart ...

Read More »

RabbitMQ: Scheduled Message Delivery

Earlier this month I gave a presentation at ComoRichWeb on RabbitMQ and one question from an attendee was “Is it possible to publish a message to be consumed at a later date?” I answered that it wasn’t possible to the best of my knowledge, but that there might be some hack to accomplish it. Well, this evening while trying to ...

Read More »

5 useful methods JSF developers should know

The aim of this post is a summary about some handy methods for JSF developers they can use in their day-to-day work. An utility class is a good place to put all methods together. I would call such class FacesAccessor. The first method is probably the most used one. It returns managed bean by the given name. The bean must ...

Read More »

Configuring Quartz with JDBCJobStore in Spring

I am starting a little series about Quartz scheduler internals, tips and tricks, this is a chapter 0 – how to configure persistent job store. In Quartz you essentially have a choice between storing jobs and triggers in memory and in a relation database ( Terracotta is a recent addition to the mix). I would say in 90% of the ...

Read More »

Java 7’s Support for Suppressed Exceptions

A new constructor and two new methods were added to the Throwable class (parent of Exception and Error classes) in JDK 7. The new constructor and two new methods were added to support “suppressed exceptions” (not to be confused with the bad practice of swallowing or ignoring exceptions). In this post, I look at why these methods were introduced and ...

Read More »

MANIFEST.MF and feature.xml versioning rules

java-interview-questions-answers

I’m forever forgetting what the rules are for dependency declarations in MANIFEST.MF and feature.xml for osgi plugins and features. And Googling often results in frustration rather than an answer. So, because today I actually found a concise list of the rules, I thought I’d repost them here, with some minor edits to help clarify. OSGi Plugin Version Ranges Dependencies on ...

Read More »

JavaFX 2 Form with Tron effect

This is a simple JavaFX Login Form with a TRON like effect. In this example I am using CSS to style the TextField and Button. Here is the snippet of the CSS and Effect code: .text-field{ -fx-background-color: transparent; -fx-border-color: #00CCFF; -fx-text-fill: white; } .password-field{ -fx-background-color: transparent; -fx-border-color: #00CCFF; -fx-text-fill: white; } .button{ -fx-background-color: transparent; -fx-border-color: white; -fx-background-radius: 30; -fx-border-radius: 30; ...

Read More »

Java EE Revisits Design Patterns: Asynchronous

Although you may not find Asynchronous method calls listed as a design pattern, I find it worth to mention. So here comes the last post of my JavaEE Revisits Design Patterns series. Asynchronous method calls is not much more than multithreading. Basically it refers to a a method call which would run in a separate thread, thus the main (caller) ...

Read More »