Hi Sai,
You have to create a custom tag libray. Use that tag on the page with parameters . Suppose you define a tag library customlinks then define a tag in it rewriter . in this tag you will have to define tag class and tag extra information class . You can define parameters like link which will take the link to modify . Then in tag class you can do modifications with resourceResolver.
By doing this you tag sytax will be like <customlinks:rewriter link="link you want to modify"> Link Title</customlinks> . In place of <a></a> you can give this syntax which will return the modified <a href="mapped url"> .
Thanks