1 17 package org.apache.forrest.locationmap; 18 19 import java.util.Map ; 20 21 import org.apache.avalon.framework.parameters.Parameters; 22 import org.apache.avalon.framework.thread.ThreadSafe; 23 import org.apache.forrest.locationmap.lm.LocationMap; 24 import org.apache.cocoon.environment.ObjectModelHelper; 25 import org.apache.cocoon.matching.AbstractRegexpMatcher; 26 27 28 39 public class RegexpLocationMapMatcher extends AbstractRegexpMatcher implements ThreadSafe { 40 41 44 protected String getMatchString(Map objectModel, Parameters parameters) { 45 46 String hint = parameters.getParameter(LocationMap.HINT_PARAM,""); 47 String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI(); 48 49 if (uri.charAt(0) != '/') { 50 uri = "/" + uri; 51 } 52 if (hint.charAt(hint.length()-1) == '/') { 53 hint = hint.substring(0,hint.length()-1); 54 } 55 if (hint.charAt(0) == '/') { 56 hint = hint.substring(1); 57 } 58 59 return hint + uri; 60 } 61 62 } 63 | Popular Tags |