URLInformation info = new URLInformation(webappUrl);
String pubId = info.getPublicationId();
String area = info.getArea();
if (pubId != null && area != null && info.getDocumentUrl().length() > 1) {
ContextUtility contextUtility = null;
try {
contextUtility = (ContextUtility) serviceManager.lookup(ContextUtility.ROLE);
Session session = RepositoryUtil.getSession(this.serviceManager, contextUtility
.getRequest());
DocumentFactory map = DocumentUtil.createDocumentFactory(this.serviceManager, session);
Publication pub = map.getPublication(pubId);
DocumentLocator loc = pub.getDocumentBuilder().getLocator(map, webappUrl);
url = "/" + pubId + "/" + area + loc.getPath();