meteoサービスからポートレットを照会したいと思います。しかし、私のナビゲータが私に正しいページを与えるので、私のJavaアプリケーションはありません。ここでURLを照会するときにJavaアプリケーションとナビゲータの動作が異なる
は私のコードは、try /キャッチすることなく、次のとおりです。
public static void main(String[] args) {
// The portlet URL
String cookieUrl = "http://france.meteofrance.com/france/meteo?PREVISIONS_PORTLET.path=previsionspluie/290190";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
// Some proxy configuration
// Basic properties set to perform my task, but they might be useless as it does not work as I would
connection.setRequestProperty("Accept-Charset", "UTF-8");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12");
System.out.println(handler.getHtml(reader));
}
private String getHtml(BufferedReader reader)
{
String html = "";
for (String line; (line = reader.readLine()) != null;)
html += line + "\n";
return html;
}
あなたは一例として与えられportleのURLでそれをテストすることができます。 ナビゲータで、応答に正しい「プレビジョン・ド・プルー・ブースト・ブレスト」が含まれています。 Javaアプリケーションでは、このページが含まれています:http://france.meteofrance.com/NoCookie.htm
クッキーのようです。しかし、私が最初にクッキーを手に入れて戻してみると、どうやってそれを処理できますか?
お願いします。
答えをありがとう、私はそのlibを試してみよう...そして、この答えを得点する。 – enguerran