示例#1
0
文件: Route.cs 项目: misun-ms/TinctV2
 public Route()
 {
     this.RouteHandler = new UrlRouteHandler();
     
     Controller.ControllerBuilder.Current.SetControllerFactory(new DefaultControllerFactory());
     Controller.ControllerBuilder.Current.DefaultNamespaces = new HashSet<string>(new List<string>() { "Tinct.PlatformController" });
 }
示例#2
0
        public ShortyRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
            : base(url, defaults, constraints, dataTokens, routeHandler)
        {
            if (string.IsNullOrEmpty(url)) throw new ArgumentNullException("Route url must be defined", "url");

            var thisUrl = url;
        }
 /// <summary>
 /// 初始化一个<see cref="RewriteLowerCaseUrlRoute"/>类的新实例
 /// </summary>
 /// <param name="url"> </param>
 /// <param name="defaults"> </param>
 /// <param name="constraints"> </param>
 /// <param name="dataTokens"> </param>
 /// <param name="routeHandler"> </param>
 public RewriteLowerCaseUrlRoute(string url,
     RouteValueDictionary defaults,
     RouteValueDictionary constraints,
     RouteValueDictionary dataTokens,
     IRouteHandler routeHandler)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 { }
示例#4
0
 public Route(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler) {
     Url = url;
     Defaults = defaults;
     Constraints = constraints;
     DataTokens = dataTokens;
     RouteHandler = routeHandler;
 }
示例#5
0
 public PortalableRoute(string url, RouteValueDictionary constraints, IRouteHandler routeHandler)
     : base(url, null, constraints, routeHandler)
 {
     //Url = url;
     //Constraints = constraints;
     //RouteHandler = routeHandler;
 }
 public static void MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints, IRouteHandler routeHandler)
 {
     var newRoute = new NamedRoute(name, url, routeHandler);
     newRoute.Defaults = new RouteValueDictionary(defaults);
     newRoute.Constraints = new RouteValueDictionary(constraints);
     routes.Add(name, newRoute);
 }
示例#7
0
        public LocaleRoute(
                    string pattern, 
                    RouteValueDictionary defaults, 
                    RouteValueDictionary constraints,
                    RouteValueDictionary tokens,
                    string[] namespaces,
                    IRouteHandler routeHandler)
        {
            var localeConstraints = new RouteValueDictionary(constraints);
            localeConstraints.Add("locale", @"[a-zA-Z]{2}");

            _routeWithLocale = new Route(
                                    @"{locale}/" + pattern,
                                    defaults,
                                    localeConstraints,
                                    tokens,
                                    new LocaleRouteHandler(routeHandler));

            _routeWithoutLocale = new Route(
                                        pattern,
                                        defaults,
                                        constraints,
                                        tokens,
                                        new LocaleRouteHandler(routeHandler));

            if(namespaces != null && namespaces.Any()) {
                _routeWithLocale.DataTokens["Namespaces"] = namespaces;
                _routeWithoutLocale.DataTokens["Namespaces"] = namespaces;
            }
        }
示例#8
0
 /// <summary>
 /// 创建一个简单路由表实例
 /// </summary>
 /// <param name="name">简单路由表名称</param>
 /// <param name="handler">处理路由请求的对象</param>
 /// <param name="mvcCompatible">是否产生MVC兼容的虚拟路径(去除~/)</param>
 public SimpleRouteTable( string name, IRouteHandler handler, bool mvcCompatible )
 {
     Name = name;
       Handler = handler;
       MvcCompatible = mvcCompatible;
       UrlEncoding = Encoding.UTF8;
 }
示例#9
0
 public NamedRoute(string name, string displayName, string url, RouteValueDictionary defaults, RouteValueDictionary constraints,
                   RouteValueDictionary dataTokens, IRouteHandler routeHandler)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 {
     _name = name;
     _displayName = displayName;
 }
示例#10
0
文件: UIRoute.cs 项目: sriv/BrickPile
 /// <summary>
 /// Initializes a new instance of the <see cref="UIRoute"/> class.
 /// </summary>
 /// <param name="url">The URL.</param>
 /// <param name="defaults">The defaults.</param>
 /// <param name="routeHandler">The route handler.</param>
 public UIRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : base(url, defaults, routeHandler)
 {
     _url = url;
     _defaults = defaults;
     _routeHandler = routeHandler;
 }
        public CultureSensitiveRouteHandler(IRouteHandler routeHandler)
        {
            RouteHandler = routeHandler;

            SetCurrentCulture = true;
            SetCurrentUICulture = true;
        }
示例#12
0
        static Mock<RequestContext> GetRequestContext(string requestUrl, string routeUrl, IRouteHandler handler)
        {
            var route = new Route(routeUrl, handler);

            var sv = new Mock<NameValueCollection>(MockBehavior.Strict);
            sv.Setup(m => m.Get("IIS_UrlRewriteModule")).Returns((string)null);

            var req = new Mock<HttpRequestBase>(MockBehavior.Strict);
            req.Setup(m => m.AppRelativeCurrentExecutionFilePath).Returns("~/");
            req.Setup(m => m.PathInfo).Returns(requestUrl);
            req.Setup(m => m.ApplicationPath).Returns("/");
            req.Setup(m => m.ServerVariables).Returns(sv.Object);

            var resp = new Mock<HttpResponseBase>(MockBehavior.Strict);
            resp.Setup(m => m.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(url => url);

            var ctx = new Mock<HttpContextBase>(MockBehavior.Strict);
            ctx.Setup(m => m.Request).Returns(req.Object);
            ctx.Setup(m => m.Response).Returns(resp.Object);

            var reqCtx = new Mock<RequestContext>(MockBehavior.Strict);
            reqCtx.Setup(m => m.HttpContext).Returns(ctx.Object);
            reqCtx.Setup(m => m.RouteData).Returns(route.GetRouteData(ctx.Object));

            return reqCtx;
        }
 /// <summary>
 /// Creates a new ContentNegotiationRouteProxy.
 /// </summary>
 /// <param name="proxiedHandler">The handler to proxy, typically an MvcRouteHandler</param>
 /// <param name="map">The map containing the associations between media types and formats</param>
 /// <param name="priority">Whether the client sets the priority or the server.  The HTTP spec
 /// indicates that the client should set it, but on occasion the server may need to set it
 /// to work around bugs in browsers (e.g. Chrome prioritizes xml over html).</param>
 public ContentNegotiationRouteProxy(IRouteHandler proxiedHandler, MediaTypeFormatMap map,
     ConnegPriorityGivenTo priority = ConnegPriorityGivenTo.Client)
 {
     this.proxiedHandler = proxiedHandler;
     this.map = map;
     this.priority = priority;
 }
 public RouteData(RouteBase route, IRouteHandler routeHandler)
 {
     this._values = new RouteValueDictionary();
     this._dataTokens = new RouteValueDictionary();
     this.Route = route;
     this.RouteHandler = routeHandler;
 }
        public TranslationRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints,
			RouteValueDictionary dataTokens, IRouteHandler routeHandler)
            : base(url, defaults, constraints, dataTokens, routeHandler)
        {
            TranslationRouteRoot = this;
            TranslatedRoutes = new Dictionary<string, TranslationRoute>();
        }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KarbonRoute"/> class.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public KarbonRoute(string url, 
     IRouteHandler routeHandler)
     : base(url, routeHandler)
 {
     _url = url;
     _routeHandler = routeHandler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InitCultureRouteHandler"/> class.
 /// </summary>
 /// <param name="routeHandler">The route handler.</param>
 protected InitCultureRouteHandler([NotNull] IRouteHandler routeHandler)
 {
     if (routeHandler == null)
     {
         throw new ArgumentNullException("routeHandler");
     }
     _routeHandler = routeHandler;
 }
示例#18
0
 public ItemRoute(
     string url,
     RouteValueDictionary defaults,
     RouteValueDictionary constraints,
     IRouteHandler routeHandler)
     : base(url, defaults, constraints, routeHandler)
 {
 }
 public static IRouteBuilder AddPrefixRoute(
     this IRouteBuilder routeBuilder,
     string prefix,
     IRouteHandler handler)
 {
     routeBuilder.Routes.Add(new PrefixRoute(handler, prefix));
     return routeBuilder;
 }
示例#20
0
        public SeoRouteHandler(IRouteHandler inner, bool forceTrailingSlash, bool forceLowerCase)
        {
            if (inner == null) throw new ArgumentNullException("inner");

            _inner = inner;
            _forceTrailingSlash = forceTrailingSlash;
            _forceLowerCase = forceLowerCase;
        }
示例#21
0
 public LeftMatchingRoute(string targetUrl, IRouteHandler handler, string defaultNameSpace)
     : base(targetUrl, handler)
 {
     NeededOnTheLeft = FormatTargetUrl(targetUrl);
     DataTokens = new RouteValueDictionary{
         {"Namespaces", new[] { defaultNameSpace }}
     };
 }
示例#22
0
 public SeoRoute(string url, IRouteHandler routeHandler, Func<WorkContext> workContextFactory, ICommerceCoreModuleApi commerceCoreApi, IStaticContentService staticContentService, ICacheManager<object> cacheManager)
     : base(url, routeHandler)
 {
     _workContextFactory = workContextFactory;
     _commerceCoreApi = commerceCoreApi;
     _contentService = staticContentService;
     _cacheManager = cacheManager;
 }
示例#23
0
 public RouteData(string controller, string action, IRouteHandler routeHandler)
 {
     this.Controller = controller;
     this.Action = action;
     this.RouteHandler = routeHandler;
     this.Namespaces = RouteTable.Namespaces;
     this.Assemblies = RouteTable.Assemblies;
 }
示例#24
0
 public RootRoute(bool blogAggregationEnabled, IRouteHandler normalRouteHandler, IRouteHandler aggRouteHandler,
     IServiceLocator serviceLocator)
 {
     BlogAggregationEnabled = blogAggregationEnabled;
     NormalRouteHandler = normalRouteHandler ??
                          new PageRouteHandler("~/aspx/Dtp.aspx", serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator);
     AggregateRouteHandler = aggRouteHandler ??
                             new PageRouteHandler("~/aspx/AggDefault.aspx", serviceLocator.GetService<ISubtextPageBuilder>(), serviceLocator);
 }
示例#25
0
文件: UIRoute.cs 项目: sriv/BrickPile
 /// <summary>
 /// Initializes a new instance of the <see cref="UIRoute"/> class.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="defaults">The values to use if the URL does not contain all the parameters.</param>
 /// <param name="constraints">A regular expression that specifies valid values for a URL parameter.</param>
 /// <param name="dataTokens">Custom values that are passed to the route handler, but which are not used to determine whether the route matches a specific URL pattern. These values are passed to the route handler, where they can be used for processing the request.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public UIRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 {
     _url = url;
     _defaults = defaults;
     _constraints = constraints;
     _dataTokens = dataTokens;
     _routeHandler = routeHandler;
 }
示例#26
0
        public ContentRoute(ContentEngine engine, IRouteHandler routeHandler, IControllerMapper controllerMapper)
            : base("{controller}/{action}/{*remainingUrl}", new RouteValueDictionary(new { Action = "Index" }), routeHandler)
        {
            this.engine = engine;
            this.routeHandler = routeHandler;
            this.controllerMapper = controllerMapper ?? engine.Resolve<IControllerMapper>();

            _adminSection = (AdminSection)ConfigurationManager.GetSection("zeus/admin");
        }
示例#27
0
        public ComplexRoute(string url, RouteValueDictionary rules, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
            : base(url, defaults, constraints, dataTokens, routeHandler)
        {
            Rules = new Dictionary<string, RouteRule>();
            foreach (var pair in rules)
                Rules.Add(pair.Key, (RouteRule)pair.Value);

            placeholders = RoutePlaceholderRegex.Matches(url).Cast<Match>().Select(m => m.Groups["name"].Value).ToArray();
        }
示例#28
0
 public RenderBootstrapper(
     IUmbracoApplicationContext applicationContext, 
     IRouteHandler routeHandler, 
     IRenderModelFactory renderModelFactory)
 {
     _routeHandler = routeHandler;
     _renderModelFactory = renderModelFactory;
     _applicationContext = applicationContext;
 }
示例#29
0
		protected RegexRoute(string regex, string urlGenerator, Func<RequestContext, RouteValueDictionary, RegexRoute, VirtualPathData> getVirtualPath, RouteValueDictionary defaults, IRouteHandler routeHandler)
		{
			_getVirtualPath = getVirtualPath ?? RealGetVirtualPath;
			_urlGenerator = urlGenerator;
			_defaults = defaults;
			_routeHandler = routeHandler;
			_regex = new Regex(regex, RegexOptions.IgnoreCase | RegexOptions.Compiled);
			_groupNames = _regex.GetGroupNames();
		}
示例#30
0
        public ApiRoute(string urlBase, IRouteHandler handler, Assembly controllerAssembly)
        {
            if (urlBase.IndexOf("/") != 0) urlBase = "/" + urlBase;
            if (urlBase.LastIndexOf("/") != urlBase.Length - 1) urlBase += "/";

            UrlPrefix = urlBase;
            Handler = handler;
            Data = FindApiControllers(controllerAssembly);
        }
 public ModulesRouter(IRouteHandler defaultRouteHandler)
 {
     DefaultRouteHandler = defaultRouteHandler;
     RoutedModules       = new LinkedList <IModuleShell <TModule> >();
 }
 public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler, string[] namespaces)
     : this(url, defaults, constraints, dataTokens, routeHandler, null, null, namespaces)
 {
 }
示例#33
0
 public LowerCaseUrlRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : base(url, defaults, routeHandler)
 {
 }
示例#34
0
 public ModuleRoute(string url, IRouteHandler routeHandler) : base(url, routeHandler)
 {
 }
示例#35
0
 public FastRoute(string url, IRouteHandler routeHandler)
     : this(url, null, routeHandler)
 {
 }
示例#36
0
 public DomainRoute(string domain, string url, object defaults, IRouteHandler routeHandler)
     : base(url, new RouteValueDictionary(defaults), routeHandler)
 {
     Domain = domain;
 }
示例#37
0
 public PageRoute(string url, IRouteHandler routeHandler)
     : base(url, routeHandler)
 {
 }
 public LowercaseDashedRoute(string url, IRouteHandler routeHandler)
     : this(url, null, null, null, routeHandler, null, null, null)
 {
 }
 public LowercaseDashedRoute(string url, IRouteHandler routeHandler, string[] namespaces)
     : this(url, null, null, null, routeHandler, null, null, namespaces)
 {
 }
示例#40
0
 public LowerCaseUrlRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 {
 }
示例#41
0
 public ResourceMapper(RouteCollection routes, IRouteHandler routeHandler)
 {
     this.routes       = routes;
     this.routeHandler = routeHandler;
 }
示例#42
0
 /// <summary>
 /// Initializes a new instance of the System.Web.Routing.Route class, using the specified URL pattern, handler class, default parameter values and constraints.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="defaults">The values to use if the URL does not contain all the parameters.</param>
 /// <param name="constraints">A regular expression that specifies valid values for a URL parameter.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public LocalizedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler)
     : base(url, defaults, constraints, routeHandler)
 {
 }
示例#43
0
 /// <summary>
 /// Initializes a new instance of the System.Web.Routing.Route class, using the specified URL pattern and handler class.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public LocalizedRoute(string url, IRouteHandler routeHandler)
     : base(url, routeHandler)
 {
 }
示例#44
0
 /// <summary>
 /// Initializes a new instance of the System.Web.Routing.Route class, using the specified URL pattern and handler class.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public GenericPathRoute(string url, IRouteHandler routeHandler)
     : base(url, routeHandler)
 {
 }
示例#45
0
 public FastRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : this(url, defaults, null, routeHandler)
 {
 }
示例#46
0
 /// <summary>
 /// Initializes a new instance of the System.Web.Routing.Route class, using the specified URL pattern, handler class and default parameter values.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="defaults">The values to use if the URL does not contain all the parameters.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public GenericPathRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : base(url, defaults, routeHandler)
 {
 }
 public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext, string[] namespaces)
     : this(url, defaults, constraints, null, routeHandler, area, areaContext, namespaces)
 {
 }
 public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler)
     : this(url, defaults, constraints, null, routeHandler, null, null, null)
 {
 }
示例#49
0
 public ModuleRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : base(url, defaults, routeHandler)
 {
 }
示例#50
0
 public CORSInterceptorHandler(IRouteHandler routeHandler, params string[] accessOrigins)
 {
     _routeHandler  = routeHandler;
     _accessOrigins = accessOrigins;
 }
示例#51
0
 public void WithRouteHandler(IRouteHandler routeHandler)
 {
     RouteHandler = routeHandler;
 }
示例#52
0
 public LowerCaseUrlRoute(string url, IRouteHandler routeHandler)
     : base(url, routeHandler)
 {
 }
 public LowercaseDashedRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler, string[] namespaces)
     : this(url, defaults, null, null, routeHandler, null, null, namespaces)
 {
 }
 public static FluentHost AddHandler(this FluentHost host, IRouteHandler handler)
 {
     host.Handlers.Add(handler);
     return(host);
 }
示例#55
0
 /// <summary>
 /// Initializes a new instance of the System.Web.Routing.Route class, using the specified URL pattern, handler class, default parameter values,
 /// constraints,and custom values.
 /// </summary>
 /// <param name="url">The URL pattern for the route.</param>
 /// <param name="defaults">The values to use if the URL does not contain all the parameters.</param>
 /// <param name="constraints">A regular expression that specifies valid values for a URL parameter.</param>
 /// <param name="dataTokens">Custom values that are passed to the route handler, but which are not used to determine whether the route matches a specific URL pattern. The route handler might need these values to process the request.</param>
 /// <param name="routeHandler">The object that processes requests for the route.</param>
 public GenericPathRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 {
 }
 public LowercaseDashedRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext)
     : this(url, defaults, constraints, dataTokens, routeHandler, area, areaContext, null)
 {
 }
示例#57
0
        public FastRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler routeHandler)
        {
            this.ParsingRoute = new Route(url, defaults, constraints, routeHandler);

            this.Url          = url;
            this.Defaults     = defaults ?? new RouteValueDictionary();
            this.Constraints  = constraints ?? new RouteValueDictionary();
            this.RouteHandler = routeHandler;

            this.m_tokenBuilder = new PathBuilder(this.Url, this.Defaults, this.Constraints);
        }
 public LowercaseDashedRoute(string url, IRouteHandler routeHandler, AreaRegistration area, AreaRegistrationContext areaContext, string[] namespaces)
     : this(url, null, null, null, routeHandler, area, areaContext, namespaces)
 {
 }
 public LocalizationRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints,
                          RouteValueDictionary dataTokens, IRouteHandler routeHandler, string culture)
     : base(url, defaults, constraints, dataTokens, routeHandler)
 {
     Culture = culture;
 }
示例#60
0
 public DomainRoute(string domain, string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
     : base(url, defaults, routeHandler)
 {
     Domain = domain;
 }