Saturday, March 14, 2009

What is URL Encoding and URL Decoding (Servlets)

Question :What is URL Encoding and URL Decoding ? (Servlets)
Answer :URL encoding is the method of replacing all the spaces and other extra characters into their Characters and Decoding is the reverse process converting all Hex Characters back their normal For Example consider this URL, /ServletsDirectory/Hello'servlet/
When Encoded using URLEncoder.encode("/ServletsDirectory/Hello'servlet/") the output is
http%3A%2F%2Fwww.javacommerce.com%2FServlets+Directory%2FHello%27servlet%2FThis back using
URLDecoder.decode("http%3A%2F%2Fwww.javacommerce.com%2FServlets+Directory%2FHello%

No comments: