I was given this task. Do any one have any clue how to do it.
THE PROBLEM: The Web design time often creates absolute links in Web pages
(i.e., href="www.enasco.com/...."). They should be using relative links.
This is a problem because when testing on the test server, clicking a link
could take you to enasco.com (production) and the tester may not realize it.
SOLUTION: Create a Servlet Filter which will detect absolute links in the HTTP
response and collect them so that we can address the issue. We may display a
up an alert box.. I'm not sure yet. But basically, we want to strongly
discourage the use of absolute links.
Before doFilter(), wrap the HttpResponse with something that will buffer the
response as its written. After doFilter(), you can look at this buffer to
detect any variation of "href='www.enasco.com....'. Collect these into a List
of some sort.
I'd suggest using the java.util.regex package to find occurences we're
interested in spotting.