Wednesday, October 14, 2009

SSL/HTTPS Implementation

Please follow the steps for implementing the https with you jsp website

%JAVAHOME%/bin> keytool -genkey -alias infobalu -keypass infopass -keystore info.bin -storepass infoadmin

What is your first and last name?
[Unknown]:info balu
What is the name of your organizational unit?
[Unknown]: info
What is the name of your organization?
[Unknown]: information
What is the name of your City or Locality?
[Unknown]: india
What is the name of your State or Province?
[Unknown]: kerala
What is the two-letter country code for this unit?
[Unknown]: IN
Is CN=nitin pai, OU=home, O=techtracer, L=mumbai, ST=maharashtra, C=IN correct?
[no]: yes

This will complete and the info.bin file will be generated and available in your jdk bin directory

copy that into tomcat webapps folder and go to

server.xml inside the conf folder

add the below lines at 8084 port and remove comment

keystoreFile=”./webapps/info.bin”
keystorePass=”infoadmin

Restart tomcat

Friday, October 9, 2009

Removing Duplicates from HashMap

HashMap hashMap=new HashMap();
boolean flag;
for(int i=0;i< correspondenceActivityBeans.length ;i++){
flag=false;
if(!hashMap.containsKey(new Integer(correspondenceActivityBeans[i].getClientID()))){
hashMap.put(new Integer(correspondenceActivityBeans[i].getClientID()),correspondenceActivityBeans[i]);
flag=true;
}
if(flag)
tempList.add(correspondenceActivityBeans[i]);

}