Java 用 HTTP クライアント ライブラリを使用して Google Custom Search API にアクセスし、検索を実行しています。
String key = "...";
String cx = "...";
String query = "...";
// Set up the HTTP transport and JSON factory
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new JacksonFactory();
Customsearch customsearch = new Customsearch(httpTransport, jsonFactory,null);
List<Result> resultList = null;
try {
Customsearch.Cse.List list = customsearch.cse().list(query);
list.setKey(key);
list.setCx(cx);
Search results = list.execute();
}catch (Exception e) {
LOG.debug("Exception: " + e);
}
動作しますが、常に次の警告が表示されます。
com.google.api.client.googleapis.services.AbstractGoogleClient 警告: アプリケーション名が設定されていません。Builder#setApplicationName を呼び出します。
Java 用 HTTP クライアント ライブラリを使用してアプリケーション名を設定するにはどうすればよいですか?