Recently I had to write a program to generate Certificate Signing Request (CSR) using Java API. Here I am providing the steps I followed with Java Program to generate CSR. After that we will also make sure that its valid by validating it with verisign CSR validator tool.
Oracle Weblogic is one of the most widely used application server. Recently I have installed it on Mac OS X (10.6.4) system and created a domain. This article is intended to provide the steps for installation and creating domain and then starting and stopping domain with Terminal. I have setup Oracle Weblogic 10.3.3.0 on my system but I am sure that the setup instructions will work for other versions also.
Prerequisite for Oracle Weblogic Server Installation
1. Oracle Weblogic setup – You can download it from Oracle website for development purpose.
2. JDK 6 – Oracle Weblogic 10.3 requires Java 6 and it comes with the default Mac OS X system. You can check whether its installed or not. It will be in “/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home” directory.
In my current project, I had a requirement to read the WSDL file from the URL and store it into database as Clob. There was no validation required, so it was kind of reading URL as String and then storing it into database table.
Here is the program I wrote to read URL to String.
Recently I bought a new desktop system and installed Windows 7 Ultimate 64-bit on it. Being a Java Developer, the first thing I did after regular setup is to download and install JDK. I was using Windows XP, Solaris or Mac OS for my development purpose till now and I was installing it for the first time on Windows 7 64-bit OS.
Here I am providing steps to download, install and configure Java in Windows 7 64-bit operating system.
Singleton is one of the most widely used creational design pattern to restrict the object creation by applications. In real world applications, resources like Database connections or Enterprise Information Systems (EIS) are limited and should be used wisely to avoid any resource crunch. To achieve this, we can implement Singleton design pattern to create a wrapper class around the resource and limit the number of object created at runtime to one.
In general we follow below steps to create a singleton class:
1. Override the private constructor to avoid any new object creation with new operator.
2. Declare a private static instance of the same class
3. Provide a public static method that will return the singleton class instance variable. If the variable is not initialized then initialize it or else simply return the instance variable.
Secured Socket Layer (SSL) is the cryptography protocol to provide message security over the internet. It works on the notion of Private and Public keys and messages are encrypted before sending it over the network. To configure SSL on Tomcat, we need a digital certificate that can be created using Java keytool for development environment. For production environment, you should get the digital certificate from SSL certificate providers, for example, Verisign or Entrust.
HashMap is one of the most widely used implementation of Map to store key-value pairs. It has been introduced in Java 1.2 and here I am trying to implement HashMap with ArrayList. The below code will provide two of the basic HashMap functions i.e get(key) and put(key, value). The code also takes care of checking duplicate values while storing.
Please note that its just the basic implementation and should not be used as a replacement of HashMap. Also while testing the code, make sure that the Object used in the KEY has proper implementation of equals() method.
StringBuffer is the thread safe utility class to perform several operations on Strings. It contains append() and insert() methods that are widely used to perform operation on Strings in a multi-thread environment. If you will check the source code, most of its functions are synchronized for thread safety.
Since most of the String operations, for example concatenation happens in a single thread environment, Java 1.5 introduced another utility class StringBuilder to perform similar operations but doesn’t provide thread safety. If you will look into its source code, all the methods are unsynchronized.
Immutable objects are instances whose state doesn’t change after it has been initialized. For example, String is an immutable class and once instantiated its value never changes.
Immutable objects are good for caching purpose because you don’t need to worry about the value changes. Other benefit of immutable class is that it is inherently thread-safe, so you don’t need to worry about thread safety in case of multi-threaded environment.
Here I am providing a way to create immutable class via an example for better understanding.
If you are a Java Developer, I am sure that you must be aware of ConcurrentModificationException that comes when you want to modify the Collection object while using iterator to go through with all its element.
Java 1.5 has introduced java.util.concurrent package with Collection classes implementations that allow you to modify your collection object at runtime.
ConcurrentHashMap is the class that is similar to HashMap but works fine when you try to modify your map at runtime.