This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get internal HTML link from HttpServletRequest object?