Wednesday, 3 July 2013
normal red2
public static String RecipeList(String catId) {
try {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(postURL+"Recipelist/");
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("category_id",catId));
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params,HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
response = EntityUtils.toString(resEntity);
response = response.trim();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Recipe Response return back to calling ()" + response);
return response;
}
reddatabae 2
public static String home(String udid) throws IllegalStateException, ClientProtocolException, IOException {
try{
HttpClient client = new DefaultHttpClient();
// String postURL = "http://192.168.0.43/portafare/apis/apps/v1.2/";
// String postURL = "http://50.56.207.251/portafare/apis/apps/v1.2/";
HttpPost post = new HttpPost(postURL);
post.setHeader("USER_UDID", udid);
List<NameValuePair> params = new ArrayList<NameValuePair>();
str=jsonEncodinghome().toString();
//System.out.println("json="+str);
params.add(new BasicNameValuePair("Data",str));
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params,HTTP.UTF_8);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
str=EntityUtils.toString(resEntity);
str=str.trim();
System.out.println("PARAM= " + params);
}
catch (Exception e) {
e.printStackTrace();
}
//System.out.println("json ================="+str);
System.out.println("home RESPONSE = " + str);
return str;
}
public static JSONObject jsonEncodinghome(){
/** Called when the activity is first created. */
JSONObject hobj=new JSONObject();
try{
JSONArray argsArray = new JSONArray();
hobj.put("argsArray", "");
hobj.put("methodName","getAllContent");
hobj.put("className","Recipe");
}
catch(Exception e){
}
return(hobj);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment