private PathEntry getPathEntry ( UriEntry uri ) { PathEntry pathEntry = new PathEntry ( ContextRouter . MAP_PATH_TYPE , "default" ) ; int length = uri . getLength ( ) ; // like /a or / if ( length < 2 ) return pathEntry ; String requestUri = uri . getRequestUri ( ) ; String last_str = uri . get ( length - 1 ) ; if ( last_str . equals ( "*" ) || last_str . equals ( "" ) ) { // StringBuffer buffer = new StringBuffer(); // buffer.append('/'); // // for(int i = 0; i < length - 1; i++) // { // buffer.append(uri.get(i) + "/"); // } // position of last / charactor int lastPosition = requestUri . lastIndexOf ( ' ' ) ; pathEntry . type = ContextRouter . MATCH_PATH_TYPE ; pathEntry . key = requestUri . substring ( 0 , lastPosition + 1 ) ; // @TODO maybe we should get parameters to pathEntry } else { pathEntry . key = requestUri ; } return pathEntry ; }
get the final key with specified path