4
4
import android .os .Message ;
5
5
6
6
import org .apache .http .HttpEntity ;
7
+ import org .apache .http .HttpResponse ;
7
8
import org .apache .http .client .methods .HttpUriRequest ;
8
9
import org .apache .http .impl .client .DefaultHttpClient ;
9
10
import org .apache .http .protocol .HttpContext ;
@@ -19,15 +20,15 @@ public abstract class SyncHttpClient extends AsyncHttpClient {
19
20
protected AsyncHttpResponseHandler responseHandler = new AsyncHttpResponseHandler () {
20
21
21
22
@ Override
22
- protected void sendResponseMessage (org . apache . http . HttpResponse response ) {
23
+ protected void sendResponseMessage (HttpResponse response ) {
23
24
responseCode = response .getStatusLine ().getStatusCode ();
24
25
super .sendResponseMessage (response );
25
26
}
26
27
27
28
@ Override
28
29
protected void sendMessage (Message msg ) {
29
30
/*
30
- * Dont use the handler and send it directly to the analysis
31
+ * Dont use the handler and send it directly to the analysis
31
32
* (because its all the same thread)
32
33
*/
33
34
handleMessage (msg );
@@ -63,7 +64,7 @@ protected void sendRequest(DefaultHttpClient client,
63
64
}
64
65
65
66
/*
66
- * will execute the request directly
67
+ * will execute the request directly
67
68
*/
68
69
new AsyncHttpRequest (client , httpContext , uriRequest , responseHandler )
69
70
.run ();
@@ -73,13 +74,12 @@ protected void sendRequest(DefaultHttpClient client,
73
74
74
75
public void delete (String url , RequestParams queryParams ,
75
76
AsyncHttpResponseHandler responseHandler ) {
76
- // TODO what about query params??
77
- delete (url , responseHandler );
77
+ delete (getUrlWithQueryString (isUrlEncodingEnabled (), url , queryParams ), responseHandler );
78
78
}
79
79
80
80
public String get (String url , RequestParams params ) {
81
81
this .get (url , params , responseHandler );
82
- /*
82
+ /*
83
83
* the response handler will have set the result when this line is
84
84
* reached
85
85
*/
@@ -101,7 +101,7 @@ public String put(String url) {
101
101
return result ;
102
102
}
103
103
104
- public String post (String url , HttpEntity entity ){
104
+ public String post (String url , HttpEntity entity ) {
105
105
this .post (null , url , entity , null , responseHandler );
106
106
return result ;
107
107
}
0 commit comments