HttpExchange getRequestURI ends before the first ampersand "&"

589 Views Asked by At

The original URI is (let's say): http://xx.xx.xxx.xx:8000/mypath?parm1=1&parm2=he

getRequestURI returns : http://xx.xx.xxx.xx:8000/mypath?parm1=1 It ignores the 2nd parameter.

If I replace the & by comma(s), it returns the full URI with all the parameters.

Have you experienced the same problem? Have you any solution? Is it a way of reading the first GET header line via another method? (Using HTTPServer).

1

There are 1 best solutions below

0
On

Sending the URI URLencoded, that is replacing special characters by percent uuencode code, resolves the problem.

Example: http://xx.xx.xxx.xx:8000/mypath?parm1=1&parm2=he

becomes: http://xx.xx.xxx.xx:8000/mypath?parm1=1&parm2=he

or even: http://xx.xx.xxx.xx:8000/mypath?parm1=1&parm2=he (no need to encode the 1st part)

and getRequestURI returns all the parameters.