3

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

Raedwald
  • 46,613
  • 43
  • 151
  • 237

2 Answers2

5

#test=123 is called an Anchor. And Anchors are not submitted to the server, they only reside in the Broswer

@see:

Community
  • 1
  • 1
Ralph
  • 118,862
  • 56
  • 287
  • 383
0

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;
Jeevan Patil
  • 6,029
  • 3
  • 33
  • 50
  • Downvoter, Please let me know the reason. Read the accepted answer here & let me know what was wrong in my answer. http://stackoverflow.com/questions/6745993/how-to-get-the-anchor-name-in-http-get – Jeevan Patil Mar 29 '13 at 07:35
  • 1
    Well I thought it was a perfectly valid answer. Back up to 0! – user2219808 Sep 29 '18 at 12:51