2013-11-09 1 views
0

내 서버 (부두)가 특정 주소의 네트워크를 통해 액세스되기를 원합니다. 외부 주소를 사용하도록 부두 서버를 구성하려면 어떻게해야합니까 (예 : my_address_name.org). 때문에 기본적으로Java jetty 외부 주소

:

가 로컬 호스트에서 실행
server = new Server(port); 
     WebAppContext context = new WebAppContext(); 

     context.setResourceBase(app_path); 
     context.setDescriptor(app_path + "WEB-INF/web.xml"); 

     context.setConfigurations(new Configuration[] { 
       new AnnotationConfiguration(), new WebXmlConfiguration(), 
       new WebInfConfiguration(), new TagLibConfiguration(), 
       new PlusConfiguration(), new MetaInfConfiguration(), 
       new FragmentConfiguration(), new EnvConfiguration() }); 

     context.setContextPath(context_path); 
     context.setParentLoaderPriority(true); 
     server.setHandler(context); 

     try { 
      server.start(); 
      server.join(); ... 

...

답변

0

이 예제는 특정 IP에 결합하여 포트 9090에서 수신합니다 : 내가 기억하는 경우 (

Connector con = new SelectChannelConnector(); 
con.setHost("192.168.1.20"); 
con.setPort(9090); 
server.addConnector(con); 

을 우물 제티는 항상 기본적으로 모든 IP (0.0.0.0)에 바인딩됩니다.