URL fetch
GAEからWEBサービスを呼び出す時はURL fetchなるものを使うらしい。
http://code.google.com/intl/ja/appengine/docs/java/urlfetch/
よって、以前このようにしていた部分は、
URL url = new URL("http://api.iknow.co.jp/items/matching/" + translateForm.getWord() + ".xml?per_page=5"); con = (HttpURLConnection) url.openConnection(); con.setRequestProperty("Content-type", "text/plain"); con.setRequestMethod("GET");
次のようにするのがGAE流。URLFetchServiceFactory辺りのクラスはgoogle提供のクラス。
URLFetchService ufs = URLFetchServiceFactory.getURLFetchService(); HTTPRequest httpRequest = new HTTPRequest(new URL( "http://api.iknow.co.jp/items/matching/" + translateForm.getWord() + ".xml?per_page=5")); HTTPResponse httpResponse = ufs.fetch(httpRequest);
■参考にさせていただきました
http://gethapp.com/blog/2009/04/11/gaej%E3%81%A7url-fetch%E3%81%97%E3%81%A6%E3%81%BF%E3%82%8B/