I want to access information from same domain but with different port number, To allow this I am adding Access-Control-Allow-Origin with the response header.
Solution:
Instead of using setHeader method I have used addHeader.
response.addHeader("Access-Control-Allow-Origin", "*");
* in above line will allow access to all domains, For allowing access to specific domain only:
response.addHeader("Access-Control-Allow-Origin", "http://www.example.com");
For issues related to IE<=9, Please see here.