?
Solved

getting anchor tag from HttpServletRequest

Posted on 2005-03-29
5
Medium Priority
?
2,058 Views
Last Modified: 2009-02-17
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?
0
Comment
Question by:HappyEngineer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 13657270
If the browser is not sending it then there is no way for the server to get it.
0
 

Author Comment

by:HappyEngineer
ID: 13657276
The browser is definitely sending it. It's in our apache logs.
0
 
LVL 92

Expert Comment

by:objects
ID: 13657338
So have you tested the claims in the above post (which states it is *not* sent).
0
 
LVL 15

Accepted Solution

by:
aozarov earned 1000 total points
ID: 13657388
I never tried to get anchor tags (but I am a bit surprise that it does not work).
A work around could be to send request via javaSrcript that will replace  the URL #xxxx with ?anchor=xxxx
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13657660
Are you sure this didn't work for you?
 StringBuffer urlBuffer = HttpUtils.getRequestURL(req);
     URL url = new URL(urlBuffer.toString());
     String anchor = url.getRef();
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question