乌尔:
http://23.23.82.251:9116/solr/db/select?q=*:*+_val_:%22geodist%28%29%22&fq=(ProviderType:10)&rows=100&wt=json&indent=true&fl=ProviderID,ProviderType,ProviderName,ProviderAddress,CityAreaID,CityAreaName,City,State,Latlong,score&fq={!geofilt}&sfield=Latlong&pt=20.296059,85.82454&d=5&sort=geodist()%20asc
当我尝试在带有发布请求的 android 中使用此 url 时,我收到以下错误。
10-22 13:54:49.946: E/SearchResult(6659): Exception Name = java.lang.IllegalArgumentException
我使用了 URLEncoder.encode() 但我仍然遇到同样的错误。任何人都可以建议我在哪里写错了。下面的代码我正在使用
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
// The default value is zero, that means the timeout is not used.
int timeoutConnection = 10000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 15000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
httpclient = new DefaultHttpClient(httpParameters);
HttpPost httppost = new HttpPost(url here);
JSONObject json = new JSONObject();
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
HttpEntity httpEntity = response.getEntity();
InputStream instream = httpEntity.getContent();
String result= Utilities.convertStreamToString(instream);
json=new JSONObject(result);