I solved it. The code was alright. Problems were with browser Firefox v26 and JBoss AS 7.1.1.
Problems with Firefox seems to be common:
problem 1 - By default Firefox changes URL by appending www. and .com, which can be seen in the text of the question.
SOLUTION:
Type about:config into the address bar.
Type fixup into the "Filter" box.
Double-click browser.fixup.alternate.enabled to change its value to false.
problem 2 - By default Firefox doesn't show full URL.
SOLUTION:
Type about:config into the address bar.
Type browser.urlbar.trimURLs into the "Filter" box.
Double-click browser.urlbar.trimURLs to change its value to false.
Problem with JBoss AS 7.1.1 was localhost URL. Usually worked with localhost:8080, but now works with 127.0.0.1:8080.
So, that is it.