Пример #1
0
        /// <exception cref="System.Exception"/>
        protected internal virtual void StartTomcat()
        {
            tomcat = new Tomcat();
            FilePath  @base = new FilePath(Runtime.GetProperty("java.io.tmpdir"));
            Context   ctx   = tomcat.AddContext("/foo", @base.GetAbsolutePath());
            FilterDef fd    = new FilterDef();

            fd.SetFilterClass(typeof(AuthenticatorTestCase.TestFilter).FullName);
            fd.SetFilterName("TestFilter");
            FilterMap fm = new FilterMap();

            fm.SetFilterName("TestFilter");
            fm.AddURLPattern("/*");
            fm.AddServletName("/bar");
            ctx.AddFilterDef(fd);
            ctx.AddFilterMap(fm);
            Tomcat.AddServlet(ctx, "/bar", typeof(AuthenticatorTestCase.TestServlet).FullName
                              );
            ctx.AddServletMapping("/bar", "/bar");
            host = "localhost";
            port = GetLocalPort();
            tomcat.SetHostname(host);
            tomcat.SetPort(port);
            tomcat.Start();
        }