Hi Experts,
i am trying a GET request to my server with some extra headers
dont know how can i add header
here is my code:
DefaultHttpClient client = new DefaultHttpClient();
HttpGet method = null;
HttpResponse resp = null;
method = new HttpGet( new URI(url) );
} catch (Exception e) {
e.printStackTrace();
}
try {
resp = client.execute(method);
} catch (IOException e) {
e.printStackTrace();
}
///////////////////
i can add header like below but this shows me POST
HttpURLConnection httpConnection = (HttpURLConnection)
url.openConnection();
String boundary = "myboundary";
httpConnection.setDoOutput(true);
httpConnection.setDoInput(true);
httpConnection.setUseCaches(false);
//httpConnection.setRequestMethod("GET");
httpConnection.setRequestProperty("Connection","Keep-
Alive");
httpConnection.setRequestProperty("Content-Type","multipart/form-
data; boundary=" + boundary);
httpConnection.setRequestProperty("user-agent",this.user_agent);
httpConnection.setRequestProperty("accept-
language",this.accept_language);
httpConnection.setRequestProperty("user-agent-
id",this.user_agent_id);
httpConnection.setAllowUserInteraction(true);
httpConnection.setInstanceFollowRedirects(true);
//httpConnection.connect();
DataOutputStream wr = new DataOutputStream
(httpConnection.getOutputStream());
any solution to add header in GET?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---