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);
精彩评论