-2

I am using the following url for fetching values from server.

http://yyy.com/2013-01-01/search?q=t*&q.options={"defaultOperator":"and","fields":["name"]}&fq=(and directorytype:'directory1')

I am gettting the following error when running the app

Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 201

The error is pointing to the following line of code

HttpGet httpget = new HttpGet(URL);

Can anybody help

Sundeep
  • 375
  • 2
  • 4
  • 16

1 Answers1

1

You need to encode your parameters values. You can't have spaces,*,(,) and many more characters in your url, for example space should be %20 instead. Use java.net.URLEncoder.encode(String s, String encoding) to encode them.

ItayD
  • 533
  • 6
  • 23