Category Archives: Java

Spring C-notation

In a previous post, I talked about¬†Spring P-notation. ¬†In this blog post, I will give an example of the Spring C-notation for constructor arguments. The C-notation namespace needs to be added to your configuration file. All that is left is … Continue reading

Posted in Java | Tagged , , , , , , , , , | Leave a comment

Random Number Generator provider abstract class

I had a need to support multiple hardware random number generators (RNG) in a project. I started with an RngProvider abstract class. This class defines the functionality that will be the same and defines a method that will contain the … Continue reading

Posted in Java | Tagged , , , , , , , , , , | Leave a comment

Filling a queue asynchronously via a thread

I was working with a hardware random number generator (RNG) and what it came down to was we needed a cache of numbers that were available, but also needed the fill the numbers without slowing the process of giving out … Continue reading

Posted in Java | Tagged , , , , , , | Leave a comment

Apache HttpClient 4 byte handling

After I wrote my own HttpClient ResponseHandler in Apache HttpClient 4 Custom Bytes ResponseHandler, I discovered that there might be a better way. I had used the following utility to get the bytes. I found that one of their classes … Continue reading

Posted in Java | Tagged , , , , | Leave a comment

Apache HttpClient 4 Custom Bytes ResponseHandler

An interesting thing I needed was to retrieve an image from a URL. HttpClient provides a BasicResponseHandler, which returns a String. I needed bytes in order to accomplish this, I had to implement my own response handler.

Posted in Java | Tagged , , , , , | 1 Comment

Apache HttpClient 4 JSON post example with a generic method

In a previous post HttpClient 4 Json Post I showed how to post a Json object to a URL. That was useful, but required writing a method for each type of object you needed posted. A cleaner way is to … Continue reading

Posted in Java | Tagged , , , , , , , | Leave a comment

Apache HttpClient 4 JSON post example

Posting JSON to a URL is a common use case. Here is a follow-on to HttpClient Post for a String. Line 13 and 14 convert the object to be posted into a Json string and set it as the payload … Continue reading

Posted in Java | Tagged , , , , | 1 Comment