Show
Ignore:
Timestamp:
06/17/09 14:28:52 (1 year ago)
Author:
hannes
Message:

Additional patches from Bernhard Froehlich (decke) fixing various issues in JettyServer.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • helma/helma/branches/jetty6/src/helma/main/JettyServer.java

    r9578 r9833  
    2222import org.mortbay.jetty.bio.SocketConnector; 
    2323import org.mortbay.jetty.nio.SelectChannelConnector; 
     24import org.mortbay.xml.XmlConfiguration; 
    2425 
    25 import java.util.StringTokenizer; 
    2626import java.net.URL; 
    2727import java.net.InetSocketAddress; 
     
    4646 
    4747    private JettyServer(URL url) throws IOException { 
    48         // TODO: this is wrong. url is supposed to be the url of a jetty config file. 
    49         http = new org.mortbay.jetty.Server(url.getPort()); 
    50         openListeners(); 
     48        http = new org.mortbay.jetty.Server(); 
     49 
     50        try { 
     51            XmlConfiguration config = new XmlConfiguration(url); 
     52            config.configure(http); 
     53 
     54            openListeners(); 
     55        } catch (IOException e) { 
     56            throw e; 
     57        } catch (Exception e) { 
     58            throw new RuntimeException("Jetty configuration problem: " + e); 
     59        } 
    5160    } 
    5261 
     
    7584                http.addConnector(ajp13); 
    7685 
    77             String jkallow = server.sysProps.getProperty("allowAJP13"); 
    78  
    79             // by default the AJP13-connection just accepts requests from 127.0.0.1 
    80             if (jkallow == null) { 
    81                 jkallow = "127.0.0.1"; 
     86            // jetty6 does not support protection of AJP13 connections anymore 
     87            if (server.sysProps.containsKey("allowAJP13")) { 
     88                String message = "allowAJP13 property is no longer supported. " + 
     89                        "Please remove it from your config and use a firewall " + 
     90                        "to protect the AJP13 port"; 
     91                server.getLogger().error(message); 
     92                throw new RuntimeException(message); 
    8293            } 
    8394 
    84             StringTokenizer st = new StringTokenizer(jkallow, " ,;"); 
    85             String[] jkallowarr = new String[st.countTokens()]; 
    86             int cnt = 0; 
    87  
    88             while (st.hasMoreTokens()) { 
    89                 jkallowarr[cnt] = st.nextToken(); 
    90                 cnt++; 
    91             } 
    92  
    93             // TODO: 
    94             //ajp13.setRemoteServers(jkallowarr); 
    9595            server.getLogger().info("Starting AJP13-Listener on port " + (ajpPort));             
    9696        } 
     
    101101        return http; 
    102102    } 
    103 /* TODO: 
    104     public HttpContext getContext(String contextPath) { 
    105         return http.getContext(contextPath); 
    106     } 
    107  
    108     public HttpContext addContext(String contextPath) { 
    109         return http.addContext(contextPath); 
    110     } 
    111 */ 
    112103 
    113104    public void start() throws Exception {