Problem generating GET url

Posted by Bruce on Stack Overflow See other posts from Stack Overflow or by Bruce
Published on 2010-05-30T10:16:39Z Indexed on 2010/05/30 10:22 UTC
Read the original article Hit count: 176

Filed under:
|

I am working on Java. I am calling a GET url on my own machine using Java. Here is the url string with the arguments.

listen.executeUrl("http://localhost/post_message.php?query_string="+str); 

I am taking str as user input.

 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 System.out.print("Enter query: ");
 str = br.readLine();

How do I encode str into GET argument. For eg.

str -> test query

url -> http://localhost/post_message.php?query_string=test%20query

© Stack Overflow or respective owner

Related posts about java

Related posts about url