Пример #1
0
        private static Route getResult(RouteSetting setting, RouteParseInfo routeInfo)
        {
            Route           result = setting.getRouteWithDefaultValue();
            List <PathItem> items  = setting.GetNamedItem();


            for (int i = 0; i < items.Count; i++)
            {
                String[] arrValue = routeInfo.getPathArray();

                if (i > arrValue.Length - 1)
                {
                    break;
                }

                PathItem item = items[i];
                if (item.isNamed() == false)
                {
                    continue;
                }

                String val = arrValue[i];
                if (strUtil.IsNullOrEmpty(val))
                {
                    continue;
                }

                // 如果条件不符合,跳过此条route
                if (setting.getRequirements().match(item.getName(), val) == false)
                {
                    return(null);
                }

                result.setItem(item.getName(), val);
            }

            return(result);
        }
Пример #2
0
        private static Route getResult( RouteSetting setting, RouteParseInfo routeInfo ) {

            Route result = setting.getRouteWithDefaultValue();
            List<PathItem> items = setting.GetNamedItem();


            for (int i = 0; i < items.Count; i++) {

                String[] arrValue = routeInfo.getPathArray();

                if (i > arrValue.Length - 1) break;

                PathItem item = items[i];
                if (item.isNamed() == false) continue;

                String val = arrValue[i];
                if (strUtil.IsNullOrEmpty( val )) continue;

                // 如果条件不符合,跳过此条route
                if (setting.getRequirements().match( item.getName(), val ) == false) return null;

                result.setItem( item.getName(), val );
            }

            return result;
        }