Diff
Modified: trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ConnectionManager.java (2468 => 2469)
--- trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ConnectionManager.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ConnectionManager.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.util.Properties;
+import java.net.URI;
public class ConnectionManager {
@@ -18,7 +19,12 @@
}
public static Connection getConnection(ServerMetaData server) throws IOException {
- return factory.getConnection(server);
+ URI location = server.getLocation();
+ if (location.getScheme().equals("http")){
+ return new HttpConnectionFactory().getConnection(server);
+ } else {
+ return factory.getConnection(server);
+ }
}
public static void setFactory(String factoryName) throws IOException {
Modified: trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/JNDIContext.java (2468 => 2469)
--- trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/JNDIContext.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/JNDIContext.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -1,10 +1,9 @@
package org.openejb.client;
import java.io.Serializable;
-import java.net.InetAddress;
import java.net.URL;
-import java.net.UnknownHostException;
import java.net.URISyntaxException;
+import java.net.URI;
import java.util.Hashtable;
import javax.naming.ConfigurationException;
@@ -69,30 +68,31 @@
String userID = (String) env.get(Context.SECURITY_PRINCIPAL);
String psswrd = (String) env.get(Context.SECURITY_CREDENTIALS);
- Object serverURL = env.get(Context.PROVIDER_URL);
+ Object serverURI = env.get(Context.PROVIDER_URL);
- if (serverURL == null) serverURL = "localhost:4201";
+ if (serverURI == null) serverURI = "foo://localhost:4201";
if (userID == null) userID = "anonymous";
if (psswrd == null) psswrd = "anon";
- URL url;
- if (serverURL instanceof String) {
- try {
- url = "" URL("http://" + serverURL);
- } catch (Exception e) {
- e.printStackTrace();
- throw new ConfigurationException("Invalid provider URL: " + serverURL);
- }
- } else if (serverURL instanceof URL) {
- url = "" serverURL;
- } else {
- throw new ConfigurationException("Invalid provider URL: " + serverURL);
- }
+// URL url;
+// if (serverURI instanceof String) {
+// try {
+// url = "" URL("http://" + serverURI);
+// } catch (Exception e) {
+// e.printStackTrace();
+// throw new ConfigurationException("Invalid provider URL: " + serverURI);
+// }
+// } else if (serverURI instanceof URL) {
+// url = "" serverURI;
+// } else {
+// throw new ConfigurationException("Invalid provider URL: " + serverURI);
+// }
try {
- server = new ServerMetaData(url.getHost(), url.getPort());
+ URI location = new URI((String) serverURI);
+ server = new ServerMetaData(location);
} catch (URISyntaxException e) {
- throw new ConfigurationException("Invalid provider URL:" + serverURL + ": host unkown: " + e.getMessage());
+ throw new ConfigurationException("Invalid provider URL:" + serverURI + ": host unkown: " + e.getMessage());
}
authenticate(userID, psswrd);
Modified: trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ServerMetaData.java (2468 => 2469)
--- trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ServerMetaData.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-client/src/main/java/org/openejb/client/ServerMetaData.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -16,10 +16,6 @@
public ServerMetaData() {
}
- public ServerMetaData(String host, int port) throws URISyntaxException {
- this.location = new URI("foo://"+host+":"+port);
- }
-
public ServerMetaData(URI location) {
this.location = location;
}
@@ -32,6 +28,11 @@
return location.getHost();
}
+
+ public URI getLocation() {
+ return location;
+ }
+
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
String uri = (String) in.readObject();
try {
Modified: trunk/openejb3/server/openejb-ejbd/src/main/java/org/openejb/server/ejbd/ClientObjectFactory.java (2468 => 2469)
--- trunk/openejb3/server/openejb-ejbd/src/main/java/org/openejb/server/ejbd/ClientObjectFactory.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-ejbd/src/main/java/org/openejb/server/ejbd/ClientObjectFactory.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -1,6 +1,6 @@
package org.openejb.server.ejbd;
-import java.net.UnknownHostException;
+import java.net.URI;
import org.openejb.DeploymentInfo;
import org.openejb.ProxyInfo;
@@ -20,7 +20,7 @@
public ClientObjectFactory(EjbDaemon daemon) {
try {
- this.sMetaData = new ServerMetaData("127.0.0.1", 4201);
+ this.sMetaData = new ServerMetaData(new URI("foo://"+"127.0.0.1" +":"+4201));
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/openejb3/server/openejb-ejbd/src/test/java/org/openejb/RemoteiTest.java (2468 => 2469)
--- trunk/openejb3/server/openejb-ejbd/src/test/java/org/openejb/RemoteiTest.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-ejbd/src/test/java/org/openejb/RemoteiTest.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -100,7 +100,7 @@
public Properties getContextEnvironment() {
Properties props = new Properties();
props.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
- props.put("java.naming.provider.url", "127.0.0.1:"+port);
+ props.put("java.naming.provider.url", "foo://127.0.0.1:"+port);
props.put("java.naming.security.principal", "testuser");
props.put("java.naming.security.credentials", "testpassword");
return props;
Modified: trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpRequestImpl.java (2468 => 2469)
--- trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpRequestImpl.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpRequestImpl.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -222,7 +222,7 @@
private void readRequestLine(DataInput in) throws IOException {
try {
line = in.readLine();
- System.out.println(line);
+// System.out.println(line);
} catch (Exception e) {
throw new IOException("Could not read the HTTP Request Line :"
+ e.getClass().getName()
@@ -338,7 +338,7 @@
try {
hf = in.readLine();
- System.out.println(hf);
+ //System.out.println(hf);
} catch (Exception e) {
throw new IOException("Could not read the HTTP Request Header Field :"
+ e.getClass().getName()
Modified: trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpResponseImpl.java (2468 => 2469)
--- trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpResponseImpl.java 2006-02-19 22:36:28 UTC (rev 2468)
+++ trunk/openejb3/server/openejb-http/src/main/java/org/openejb/server/httpd/HttpResponseImpl.java 2006-02-19 23:42:08 UTC (rev 2469)
@@ -231,12 +231,12 @@
*/
protected void writeMessage(OutputStream output) throws IOException{
DataOutput out = new DataOutputStream(output);
- DataOutput log = new DataOutputStream(System.out);
+ //DataOutput log = new DataOutputStream(System.out);
//System.out.println("\nRESPONSE");
closeMessage();
- writeResponseLine(log);
- writeHeaders(log);
- writeBody(log);
+// writeResponseLine(log);
+// writeHeaders(log);
+// writeBody(log);
writeResponseLine(out);
writeHeaders(out);
writeBody(out);