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.AbstractWildcardMatcher; 26 27 28 39 public class WildcardLocationMapMatcher extends AbstractWildcardMatcher 40 implements ThreadSafe { 41 42 45 protected String getMatchString(Map objectModel, Parameters parameters) { 46 47 String hint = parameters.getParameter(LocationMap.HINT_PARAM,""); 48 String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI(); 49 50 if (uri.charAt(0) != '/') { 51 uri = "/" + uri; 52 } 53 if (hint.charAt(hint.length()-1) == '/') { 54 hint = hint.substring(0,hint.length()-1); 55 } 56 if (hint.charAt(0) == '/') { 57 hint = hint.substring(1); 58 } 59 60 return hint + uri; 61 } 62 63 } 64 | Popular Tags |