pooja pooja - 1 year ago 33
Java Question

Add %% in a url query parameter

I am forming a url that contains another url as one of its query string parameters. This url is supposed to return some xml code from our webapp deployed on tomcat.
Below is the sample url that I am generating using Java:


Now the issue is when I hit this url from browser or wget it, it returns 'ERROR 500: Internal Server Error'. But if I replace the last macro '%25%25TAG_PRICE%25%25' with some real value e.g. 5.2, then this url returns valid response.

So I assume the issue is with passing %%TAG_PRICE%% in the query string. Its not working no matter its encoded or not and I need to have this macro in my url. I tried to debug it using eclipse debugger, but its not even reaching init method of web servlet. I don't know how to fix this.

Any help is appreciated. Thanks in advance.

Answer Source

Finally I figured out that if I encode the macro %%TAG_PRICE%% twice, it works fine i.e. if I insert %2525TAG_PRICE%2525 as a query parameter in the above url, browser successfully loads its content.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download