Take the 2-minute tour ×

java.lang.IllegalArgumentException: [https://localhost/pcap/search?stime=20110930%2E000000&etime=20110930%2E235959&bpf=tcp

Here is the call I made using Spring RestFul Template:

final PcapSearchResponse pcapSearchResult = restTemplate.postForObject(
    nPulseApiUris.get(2), null, PcapSearchResponse.class, sTime, eTime, bpf);

I don't understand why that is a bad URL? I used UTF-8 to encode the "." character but I am not sure why my URL is still invalid.

Your help is greatly appreciated!

Thank you for your help!!!

share|improve this question
add comment

1 Answer

The documentation of RestTemplate mentions that:

Furthermore, the String-argument methods assume that the URL String is unencoded.

So, when passing your URL as string, don't encode it. Spring will take care of that.

share|improve this answer
Hi Bozho, thank you very much for your response. Yes I did not encode the url. The URL looks like the following in my code in which the nPulseApiUris is of type List<String>: https://localhost/pcap/search?stime={stime}&amp;etime=${etime}&amp;bpf=${bpf} Your help is greatly appreciated! –  W L Oct 21 '11 at 4:28
what are the param values? –  Bozho Oct 21 '11 at 5:39
And drop thr &amp –  Bozho Oct 21 '11 at 5:41
Hi @Bozho, I greatly appreciate your response. My request parameters which I am trying to post to the RESTful service URI https://localhost/pcap/searchare: stime=20110930.000000 etime=20110930.235959 bpf=tcp Thank you so much Bozho! –  W L Oct 22 '11 at 5:36
Looks ok. Now get rid rid of amp –  Bozho Oct 22 '11 at 6:37
show 9 more comments

Your Answer


