开发者

Setting locale with DefaultHttpClient?

I'm using DefaultHttpClient to make an http connection. I [think] we can set the preferred locale in the http headers [http accept-language] when making a connection, which the server can check and send back content in a matching language (if it wants).

Anyone know if this 开发者_如何转开发is possible, or how to go about doing this with DefaultHttpClient?

Thanks


You have to add your header to HttpRequest object

HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(URL);
request.addHeader("Accept-Language", "en");
HttpResponse response = client.execute(request);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜