geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r209163 - in /geronimo/trunk/modules/jetty/src: java/org/apache/geronimo/jetty/connector/JettyConnector.java test/org/apache/geronimo/jetty/connector/ test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
Date Tue, 05 Jul 2005 01:09:29 GMT
Author: jboynes
Date: Mon Jul  4 18:09:27 2005
New Revision: 209163

URL: http://svn.apache.org/viewcvs?rev=209163&view=rev
Log:
fix for GERONIMO-701, support host attribute

Added:
    geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/
    geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
Modified:
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java?rev=209163&r1=209162&r2=209163&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/connector/JettyConnector.java
Mon Jul  4 18:09:27 2005
@@ -17,6 +17,9 @@
 
 package org.apache.geronimo.jetty.connector;
 
+import java.net.UnknownHostException;
+import java.net.InetSocketAddress;
+
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
@@ -57,7 +60,12 @@
     public String getHost() {
         return listener.getHost();
     }
-    
+
+    public void setHost(String host) throws UnknownHostException {
+        // underlying impl treats null as 0.0.0.0
+        listener.setHost(host);
+    }
+
     public int getPort() {
         return listener.getPort();
     }
@@ -66,6 +74,10 @@
         listener.setPort(port);
     }
 
+    public InetSocketAddress getAddress() {
+        return new InetSocketAddress(getHost(), getPort());
+    }
+
     public void doStart() throws Exception {
         container.addListener(listener);
         ((ThreadedServer) listener).open();
@@ -100,8 +112,9 @@
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("Jetty HTTP Connector", JettyConnector.class);
         infoFactory.addAttribute("defaultScheme", String.class, false);
-        infoFactory.addAttribute("host", String.class, false);
+        infoFactory.addAttribute("host", String.class, true);
         infoFactory.addAttribute("port", int.class, true);
+        infoFactory.addAttribute("address", InetSocketAddress.class, false);
         infoFactory.addReference("JettyContainer", JettyContainer.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.setConstructor(new String[] {"JettyContainer"});
         GBEAN_INFO = infoFactory.getBeanInfo();

Added: geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java?rev=209163&view=auto
==============================================================================
--- geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
(added)
+++ geronimo/trunk/modules/jetty/src/test/org/apache/geronimo/jetty/connector/HTTPConnectorTest.java
Mon Jul  4 18:09:27 2005
@@ -0,0 +1,40 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.jetty.connector;
+
+import java.net.UnknownHostException;
+import java.net.InetSocketAddress;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HTTPConnectorTest extends TestCase {
+    private HTTPConnector connector;
+
+    public void testAddress() throws UnknownHostException {
+        connector.setHost("localhost");
+        connector.setPort(1234);
+        assertEquals(new InetSocketAddress("localhost", 1234), connector.getAddress());
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        connector = new HTTPConnector(null);
+    }
+}



Mime
View raw message