Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get internal HTML link from HttpServletRequest object?

 
Warren Weis
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a link like

http://www.somehost.com/somepage.html#n521560

I need to capture the #n521560 ( the internal HTML link ), but I've been unable to find the component of the HTTPServletRequest that stores this.

I've tried

getRequestURI()
getQueryString()
getContextPath()
getPathInfo()
getRequestURL()
getPathTranslated()
getServletPath()

but no luck so far.
I wish this was a query parameter, but it is not.
I need to make some new code compatible with an application that is depending on the
old code's behavior.

Anyone know what component of HTTPServletRequest stores this? (Or some other object).
Thanks,

George

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

As far as I know, you can't get that information in a servlet. It is only used by the front end HTML page itself.
 
Warren Weis
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the prompt reply and welcome.
I will try and capture this portion of the URL using a rewrite rule.

However, it does seem to me that there ought to be some way to get the complete request URL as it originally arrived at the server.

thanks,

George
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic