views:

18

answers:

1

I have to design a RESTful client and service in Java. For a GET request, i need to send a regEx pattern as a query parameter. in the client i'm sending the pattern as http://localhost:6520/restservice/foo?pattern=^BP$ i'm getting Illegal Endpoint address exception. I even tried http://localhost:6520/restservice/foo?pattern='^BP$' and it still gives the same exception. Can anyone help me with this?

+1  A: 

The ^ is an illegal character in URL's and the $ is a reserved character in URL's. You'd like to URL-encode those characters first. The correct URL would then end up to be http://localhost:6520/restservice/foo?pattern=%5eBP%24

Most server side programming languages and view technologies offer facilities to convert URL's that way. Since it's unclear which one you're using, we can't give any hints how to do this. You now at least know the right keywords to search on: "URL encoding". Google around together with the programming language as keyword.

BalusC
that worked beautifully! Thanks!
charudatta