0

I am trying to get the entire url in filters but it doesn't give me after #

Browser url :

 /en_US/web/guest/regulatory/disclosures#esma_endorsement 

Below is code to get the url in my filters:

  String reqUrl = httpReq.getRequestURL().toString();  

It always gives:

    /en_US/web/guest/regulatory/disclosures

I also tried with queryString but no luck.

I want to get the url along with #symbol

Can any one help me out?

Thanks, Naresh.

2 Answers2

1

That's how it works. The # part is interpreted client side, by the browser. There's no need to ever let the server know this part. If you definitely want it, you can access it with javascript on the browser and explicitly send it to the server, using parameters. But it won't be part of the URL if you don't explicitly handle it. And when it will be, it won't be separated by #

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
1

The part that you would like to receive is not actually belong to URI. Hash character called 'fragment identifier' and it is not send to server. That part is used on some extra actions on browser.

So basically you cant retrieve that part on server side. But you can do some tricks like retrieving related part on front end and sending back to server as a part of your url like:

/en_US/web/guest/regulatory/disclosures?name=esma_endorsement 
kurt_vonnegut
  • 190
  • 3
  • 14