Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public void getJSON(String controllerName,String actionName, JSONObject requestBody,Response.Listener<JSONObject> success,Response.ErrorListener error){
  2. String url = makeURL(controllerName,actionName);
  3. JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST,url,requestBody,success,error);
  4. request.setTag(APP_TAG);
  5. requestQueue.add(request);
  6. }
  7.  
  8. public void getBooleanRequest(String controllerName,String actionName, final HashMap<String,String> body, final HashMap<String,String> header, final Response.Listener<Boolean> success,Response.ErrorListener error){
  9. String url = makeURL(controllerName,actionName);
  10. Request<Boolean> request = new Request<Boolean>(Request.Method.POST,url,error) {
  11. @Override
  12. protected Response<Boolean> parseNetworkResponse(NetworkResponse response) {
  13. return Response.success(true, HttpHeaderParser.parseCacheHeaders(response));
  14. }
  15.  
  16. @Override
  17. protected void deliverResponse(Boolean response) {
  18. success.onResponse(response);
  19. }
  20.  
  21. @Override
  22. protected Map<String, String> getParams() throws AuthFailureError {
  23. return body;
  24. }
  25.  
  26. @Override
  27. public Map<String, String> getHeaders() throws AuthFailureError {
  28. return header;
  29. }
  30. };
  31. request.setTag(APP_TAG);
  32. requestQueue.add(request);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement