Reputation: 31
I want to know how to get full request url I need #test=1234 but using HttpServletRequest request.getRequestURI() or request.getRequestURL().toString() return path only, like https://stackoverflow.com/myquestion Help me
Upvotes: 3
Views: 2589
Reputation: 120811
#test=123
is called an Anchor. And Anchors are not submitted to the server, they only reside in the Broswer
@see:
Upvotes: 5
Reputation: 6079
Anchors or URL fragments are not sent by the client to the server when requesting for a resource. The anchor's or fragment's are utilized to identify a location within a resource and not a different resource on the server.
Fragment URL is not part of the URL. You can get the anchor using javascript & save them in cookies to retain them.
var anchor = window.location.hash;
Upvotes: 2