public void EmptyVirDir()
        {
            UrlInfo info = UrlTokenizer.ExtractInfo("/home/index.rails", "");

            Assert.IsNotNull(info);
            Assert.AreEqual("home", info.Controller);
            Assert.AreEqual("index", info.Action);
            Assert.AreEqual(String.Empty, info.Area);
        }
        public void Area3()
        {
            UrlInfo info = UrlTokenizer.ExtractInfo("/myvirdirectory/mysite/clients/home/index.rails", "/myvirdirectory");

            Assert.IsNotNull(info);
            Assert.AreEqual("home", info.Controller);
            Assert.AreEqual("index", info.Action);
            Assert.AreEqual("mysite/clients", info.Area);
        }
        public void ExtensionIgnored()
        {
            UrlInfo info = UrlTokenizer.ExtractInfo("/home/index.something", null);

            Assert.IsNotNull(info);
            Assert.AreEqual("home", info.Controller);
            Assert.AreEqual("index", info.Action);
            Assert.AreEqual(String.Empty, info.Area);
            Assert.AreEqual("something", info.Extension);
        }
        public void SimpleUsage()
        {
            UrlInfo info = UrlTokenizer.ExtractInfo("/home/index.rails", null);

            Assert.IsNotNull(info);
            Assert.AreEqual("home", info.Controller);
            Assert.AreEqual("index", info.Action);
            Assert.AreEqual(String.Empty, info.Area);
            Assert.AreEqual("rails", info.Extension);
        }
Exemplo n.º 5
0
    public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
    {
        Tokenizer tokenizer = (Tokenizer)PreviousTokenStream;

        if (tokenizer == null)
        {
            tokenizer           = new UrlTokenizer(reader);
            PreviousTokenStream = tokenizer;
        }
        else
        {
            tokenizer.Reset(reader);
        }
        return(tokenizer);
    }
Exemplo n.º 6
0
        public override void DataBind()
        {
            base.DataBind();

            UrlInfo urlInfo = UrlTokenizer.ExtractInfo(Context.Request.Path, Context.Request.ApplicationPath);

            _extension = urlInfo.Extension;

            if (Controller == null || Controller.Length == 0)
            {
                Controller = urlInfo.Controller;
            }

            if (Action == null || Action.Length == 0)
            {
                Action = urlInfo.Action;
            }

            if (Area == null || Area.Length == 0)
            {
                Area = urlInfo.Area;
            }
        }
Exemplo n.º 7
0
 public ResponseAdapter(HttpResponse response, String url, String appPath)
 {
     _response  = response;
     _extension = UrlTokenizer.GetExtension(url);
     _appPath   = appPath;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Can be overriden so new semantics can be supported.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected virtual UrlInfo ExtractUrlInfo(IRailsEngineContext context)
        {
            String vdir = context.ApplicationPath;

            return(UrlTokenizer.ExtractInfo(context.Url, vdir));
        }