This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Servlets and the fly likes Get internal HTML link from HttpServletRequest object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Get internal HTML link from HttpServletRequest object?" Watch "Get internal HTML link from HttpServletRequest object?" New topic
Author

Get internal HTML link from HttpServletRequest object?

Warren Weis
Greenhorn

Joined: Jul 18, 2011
Posts: 14
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

Joined: May 26, 2003
Posts: 32605
    
215

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Warren Weis
Greenhorn

Joined: Jul 18, 2011
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get internal HTML link from HttpServletRequest object?
 
It's not a secret anymore!