예제 #1
0
        public static void Setup()
        {
            Configuration conf = new Configuration();

            conf.SetInt(HttpServer2.HttpMaxThreads, 10);
            server = CreateTestServer(conf);
            server.AddServlet("echo", "/echo", typeof(TestHttpServer.EchoServlet));
            server.AddServlet("echomap", "/echomap", typeof(TestHttpServer.EchoMapServlet));
            server.AddServlet("htmlcontent", "/htmlcontent", typeof(TestHttpServer.HtmlContentServlet
                                                                    ));
            server.AddServlet("longheader", "/longheader", typeof(HttpServerFunctionalTest.LongHeaderServlet
                                                                  ));
            server.AddJerseyResourcePackage(typeof(JerseyResource).Assembly.GetName(), "/jersey/*"
                                            );
            server.Start();
            baseUrl = GetServerURL(server);
            Log.Info("HTTP server started: " + baseUrl);
        }
예제 #2
0
 /// <exception cref="System.IO.IOException"/>
 private void InitWebHdfs(Configuration conf)
 {
     if (WebHdfsFileSystem.IsEnabled(conf, HttpServer2.Log))
     {
         // set user pattern based on configuration file
         UserParam.SetUserPattern(conf.Get(DFSConfigKeys.DfsWebhdfsUserPatternKey, DFSConfigKeys
                                           .DfsWebhdfsUserPatternDefault));
         // add authentication filter for webhdfs
         string className = conf.Get(DFSConfigKeys.DfsWebhdfsAuthenticationFilterKey, DFSConfigKeys
                                     .DfsWebhdfsAuthenticationFilterDefault);
         string name     = className;
         string pathSpec = WebHdfsFileSystem.PathPrefix + "/*";
         IDictionary <string, string> @params = GetAuthFilterParams(conf);
         HttpServer2.DefineFilter(httpServer.GetWebAppContext(), name, className, @params,
                                  new string[] { pathSpec });
         HttpServer2.Log.Info("Added filter '" + name + "' (class=" + className + ")");
         // add webhdfs packages
         httpServer.AddJerseyResourcePackage(typeof(NamenodeWebHdfsMethods).Assembly.GetName
                                                 () + ";" + typeof(Param).Assembly.GetName(), pathSpec);
     }
 }