mardi 23 juin 2015

HttpUrlConnection timeout even though page is available in the browser - JBoss issue?

I'm trying to get page content from a specific URL:

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
LOGGER.info("Response code: "+conn.getResponseCode();
... (rest of the code, not relevant at the moment) ...

I'm not able to get conn.getResponseCode(), I have timeout before it gets printed. Surprisingly, when I put the very same URL in my browser, the page will be loaded correctly. I thought it may have something do to with HTTP/HTTPS, unfortunately, after changing HttpURLConnection to HttpsURLConnection there is no difference.

Maybe it has something to do with JBoss configuration? I use JBoss 7.1.1 Final.

Aucun commentaire:

Enregistrer un commentaire