android org.apache.http.client.HttpClient user-agent

  • Android 2.2 (API Level 8)
  • リクエスト
    final HttpClient client = new DefaultHttpClient();
    final HttpParams params = client.getParams();
    params.setParameter(CoreProtocolPNames.USER_AGENT, "android user-agent hoge"); // !
    final HttpGet request = new HttpGet("http://hogehoge.com/");
    try {
    	final HttpResponse response = client.execute(request);
    	// ・・・
    } catch (ClientProtocolException e) {
    	// TODO Auto-generated catch block
    } catch (IOException e) {
    	// TODO Auto-generated catch block
    }
    
    サーバ側ログ
    192.168.100.101 - - [01/Aug/2011:01:23:45 +0900] "GET / HTTP/1.1" 200 175 "-" "android user-agent hoge"
    

0 件のコメント:

コメントを投稿