private void setupServer(Application application) { ResourceConfig rc = ResourceConfig.forApplication(application); IDictionary <string, object> properties = new Dictionary <string, object>(); properties[ServerProperties.TRACING] = "ALL"; rc.addProperties(properties); Properties serverProperties = readProperties(); int port = int.Parse(serverProperties.getProperty(PORT_PROPERTY)); URI serverUri = UriBuilder.fromPath(ROOT_RESOURCE_PATH).scheme("http").host("localhost").port(port).build(); try { server = GrizzlyHttpServerFactory.createHttpServer(serverUri, rc); } catch (System.ArgumentException e) { throw new ServerBootstrapException(e); } catch (System.NullReferenceException e) { throw new ServerBootstrapException(e); } }
private void setupServer(Application application) { ResourceConfig rc = ResourceConfig.forApplication(application); Properties serverProperties = readProperties(); int port = int.Parse(serverProperties.getProperty(PORT_PROPERTY)); URI serverUri = UriBuilder.fromPath(ROOT_RESOURCE_PATH).scheme("http").host("localhost").port(port).build(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.glassfish.grizzly.http.server.HttpServer grizzlyServer = org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(serverUri, rc); HttpServer grizzlyServer = GrizzlyHttpServerFactory.createHttpServer(serverUri, rc); try { grizzlyServer.start(); } catch (IOException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } server = grizzlyServer; }