For some reason Java doesn’t like to obey http forwards if the protocol is changing. It has been this way for a while: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4620571. So when I was trying to load https://modules.openmrs.org that had an apache redirectMatch to http://modules.openmrs.org, I would get the html for the 301 redirect instead of the source of http://modules.openmrs.org.
I was lucky that I have control over the server and could change the http/https to a simply proxy instead of redirecting. If I didn’t, I would have had to catch the protocol change and refetch the new url.
It took me a while to find an answer for this because these keywords didn’t give many results on google: URLConnection HttpURLConnection openConnection() connect() getInputStream() Apache redirectMatch 301 302.
January 8th, 2011 at 7:03 am
Is there any way to solve that problem?
I only found forum threads and blogs which all refer to the sun bug site. So this means it does not work at all?
February 8th, 2011 at 5:04 am
Found an articel relating to this problem at that helped me
http://download.oracle.com/javase/1.4.2/docs/guide/deployment/deployment-guide/upgrade-guide/article-17.html