Posts

Showing posts from March, 2014

Ajax and 302

Did  you ever wonder what happens if use request a resource via Ajax ( XmlHttpRequest or ActivexObject) for which server sends back 302 ( browser redirect ) ?  Does the xmlhttp.status==302 below will ever be true ? --------------------------------- function test302() { var xmlhttp; if (window.XMLHttpRequest)   {   xmlhttp=new XMLHttpRequest();   } else   {   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");   } xmlhttp.onreadystatechange=function()   {   if (xmlhttp.readyState==4 && xmlhttp.status==302)     {     document.getElementById("myDiv").innerHTML="resource moved."     }   } xmlhttp.open("GET","URL",true); xmlhttp.send(); } ------------------------ The answer is NO. Because browser handles it and never passes it to JavaScript.

Java Keystore, Certificates, Private Keys, Tomcat SSL

I was trying to setup Single Sign On using CAS and I had to deal with creating self signed certificate and configure Tomcat to use it. A few things I learned are following: 1. Tomcat SSL Connector can be configured in two way; JSSE or APR. JSSE uses native libraries and need different connector attributes to be configured.  APR stands for Advanced Portable Runtime. It requires additional libraries to be installed but provides more performance and flexibility.  For normal demo scenario, one may be good with JSSE connector configuration. 2.  To configure JSSE Tomcat SSL connector , you need a keystore. Assuming you are using self signed cert, use following command line. keytool -genkey  -alias ss   -keyalg RSA -keypass pwd  -storepass pwd -keystore  storefilepath This will prompt for first name , last name and organizational information.  Make sure you enter right value for the very first question "first and last name". This becomes CN ...