Link to home
Start Free TrialLog in
Avatar of HappyEngineer
HappyEngineer

asked on

getting anchor tag from HttpServletRequest

There appears to be no way to get the anchor tag from the HttpServletRequest (see http://forum.java.sun.com/thread.jspa?forumID=45&threadID=404954). However, I know that data arrives at our servers because our apache logs show urls with the anchor tags.

So, apparently that information is just being dropped.

Is there any way to hack the system to allow me to see the anchor tag? For instance, is there a servlet engine that makes it available in some other way such that I could have a servlet filter that got the anchor using the alternate means and then put it into an attribute in the HttpServletRequest that I could use in my servlets?

Perhaps there is a way to install some sort of filter on port 80 that modifies incoming urls so that the anchor is turned into a parameter of the url so that I can access it using getParameter in the servlet?
Avatar of Mick Barry
Mick Barry
Flag of Australia image

If the browser is not sending it then there is no way for the server to get it.
Avatar of HappyEngineer
HappyEngineer

ASKER

The browser is definitely sending it. It's in our apache logs.
So have you tested the claims in the above post (which states it is *not* sent).
ASKER CERTIFIED SOLUTION
Avatar of aozarov
aozarov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Are you sure this didn't work for you?
 StringBuffer urlBuffer = HttpUtils.getRequestURL(req);
     URL url = new URL(urlBuffer.toString());
     String anchor = url.getRef();