aspose file tools*
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
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: 30947
    
158

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Get internal HTML link from HttpServletRequest object?