Beispiel #1
0
        private static Route parseRoute(String apath)
        {
            if (apath == null)
            {
                return(new Route());
            }

            Route x = new Route();

            apath = processPageIndex(apath, x);

            PathAppId xPath = processAppId(apath.TrimStart('/'));
            String    path  = xPath.Path;

            x.setAppId(xPath.AppId);

            Dictionary <String, String> map = getMap();

            foreach (KeyValuePair <String, String> kv in map)
            {
                if (isLinkToLow)
                {
                    if (strUtil.EqualsIgnoreCase(path, kv.Key))
                    {
                        // path=category
                        // map.Add( "category", "wojilu.Test.Web.Mvc.TestPostController.List" );
                        return(getEqualMap(kv, x));
                    }

                    if (path.ToLower().StartsWith(kv.Key.ToLower() + separator))
                    {
                        return(getParseResult(path, kv.Value, x));
                    }
                }
                else
                {
                    if (path.Equals(kv.Key))
                    {
                        // path=category
                        // map.Add( "category", "wojilu.Test.Web.Mvc.TestPostController.List" );
                        return(getEqualMap(kv, x));
                    }

                    if (path.StartsWith(kv.Key + separator))
                    {
                        return(getParseResult(path, kv.Value, x));
                    }
                }
            }

            return(null);
        }
Beispiel #2
0
        private static PathAppId processAppId(String path)
        {
            PathAppId x = new PathAppId();

            String[] arr       = path.Split(separator[0]);
            String   firstItem = arr[0];

            if (isEndsWithInt(firstItem))
            {
                x.AppId = strUtil.GetEndNumber(firstItem);

                String firstWithoutAppId = strUtil.TrimEnd(firstItem, x.AppId.ToString());
                x.Path = firstWithoutAppId + strUtil.TrimStart(path, firstItem);
            }
            else
            {
                x.Path = path;
            }

            return(x);
        }
Beispiel #3
0
        private static PathAppId processAppId( String path )
        {
            PathAppId x = new PathAppId();

            String[] arr = path.Split( separator[0] );
            String firstItem = arr[0];

            if (isEndsWithInt( firstItem )) {
                x.AppId = strUtil.GetEndNumber( firstItem );

                String firstWithoutAppId = strUtil.TrimEnd( firstItem, x.AppId.ToString() );
                x.Path = firstWithoutAppId + strUtil.TrimStart( path, firstItem );
            }
            else {
                x.Path = path;
            }

            return x;
        }