hammant 2002/12/21 11:34:44
Modified: altrmi build.xml default.properties
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http
ClientHttpReadWriter.java
altrmi/src/java/org/apache/excalibur/altrmi/server
PublicationDescriptionItem.java
altrmi/src/test/org/apache/excalibur/altrmi/test/http
CustomHttpServletTestCase.java
Log:
HTTPClient added for servlet transport
Revision Changes Path
1.52 +5 -0 jakarta-avalon-excalibur/altrmi/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- build.xml 16 Dec 2002 01:00:00 -0000 1.51
+++ build.xml 21 Dec 2002 19:34:43 -0000 1.52
@@ -20,6 +20,8 @@
<pathelement location="${excalibur-pool.jar}"/>
<pathelement location="${checkstyle.jar}"/>
<pathelement location="${jakarta-commons-attributes.jar}"/>
+ <pathelement location="${jakarta-commons-httpclient.jar}"/>
+ <pathelement location="${jakarta-commons-logging.jar}"/>
<pathelement location="${qdox.jar}"/>
<pathelement location="${jakarta-bcel.jar}"/>
<pathelement path="${java.class.path}"/>
@@ -242,12 +244,15 @@
<target name="test" depends="compile-test" description="Perform the unit tests"
unless="skip.tests">
<echo message="Performing Unit Tests" />
+ <echo message="--${jakarta-commons-attributes.jar}" />
<ant antfile="base.xml" target="generate"/>
<mkdir dir="${build.tests}"/>
<!-- Plain tests -->
+
+ <echo message="hi" file="build/hi.txt"/>
<junit fork="true"
haltonfailure="${junit.failonerror}"
1.14 +3 -1 jakarta-avalon-excalibur/altrmi/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/default.properties,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- default.properties 3 Dec 2002 00:19:56 -0000 1.13
+++ default.properties 21 Dec 2002 19:34:43 -0000 1.14
@@ -30,6 +30,8 @@
jakarta-bcel.jar=lib/bcel.jar
qdox.jar=lib/qdox-1.0.jar
jakarta-commons-attributes.jar=./lib/commons-attributes-0.1.jar
+jakarta-commons-httpclient.jar=./lib/commons-httpclient.jar
+jakarta-commons-logging.jar=./lib/commons-logging.jar
# ----- Excalibur pool, version 1.1 or later -----
excalibur-pool.home=${basedir}/../pool/dist
@@ -63,7 +65,7 @@
conf.dir = ${src.dir}/conf
test.dir = ${src.dir}/test
xdocs.dir = ${src.dir}/xdocs
-
+
# needed by Cocoon
build.context = ${build.dir}/documentation
build.docs = ${build.dir}/docs
1.3 +20 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http/ClientHttpReadWriter.java
Index: ClientHttpReadWriter.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/http/ClientHttpReadWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClientHttpReadWriter.java 16 Dec 2002 01:00:01 -0000 1.2
+++ ClientHttpReadWriter.java 21 Dec 2002 19:34:43 -0000 1.3
@@ -12,10 +12,16 @@
import org.apache.excalibur.altrmi.common.AltrmiReply;
import org.apache.excalibur.altrmi.common.AltrmiRequest;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.commons.httpclient.HttpConnection;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.net.URLConnection;
@@ -35,16 +41,24 @@
public AltrmiReply postRequest(AltrmiRequest altrmiRequest)
throws IOException, ClassNotFoundException
{
- URL url = new URL("http",m_host, m_port,"/mystuff/Dump/");
- URLConnection connection = url.openConnection();
- connection.setDoOutput(true);
- connection.setDoInput(true);
+ //URL url = new URL("http",m_host, m_port,"/mystuff/Dump/");
+ HttpConnection connection = new HttpConnection(m_host, m_port);
+
+ HttpClient client = new HttpClient();
+ client.getHostConfiguration().setHost(m_host, m_port, "http");
+ // we shouldn't have to wait if a connection is available
+ client.setHttpConnectionFactoryTimeout( 1 );
+
+ PostMethod postMethod = new PostMethod("/mystuff/Dump/");
+ client.executeMethod(postMethod);
+
ClientCustomStreamReadWriter clientCustomStreamReadWriter;
try
{
- OutputStream outputStream = connection.getOutputStream();
- InputStream inputStream = connection.getInputStream();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ outputStream.write(postMethod.getResponseBody());
+ InputStream inputStream = postMethod.getRequestBody();
clientCustomStreamReadWriter = new ClientCustomStreamReadWriter(
inputStream, outputStream, m_interfacesClassLoader);
return clientCustomStreamReadWriter.postRequest(altrmiRequest);
1.6 +3 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/PublicationDescriptionItem.java
Index: PublicationDescriptionItem.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/PublicationDescriptionItem.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PublicationDescriptionItem.java 3 Dec 2002 00:19:57 -0000 1.5
+++ PublicationDescriptionItem.java 21 Dec 2002 19:34:43 -0000 1.6
@@ -53,7 +53,8 @@
}
catch (NoClassDefFoundError ncdfe)
{
- System.out.println("--> ncdfe");
+ System.out.println("--> ncdfe-" + ncdfe.getMessage() +
ncdfe.getCause());
+ ncdfe.printStackTrace();
// attribute jars are missing.
// This allowed for when there is no Async functionality.
}
1.3 +2 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/CustomHttpServletTestCase.java
Index: CustomHttpServletTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/http/CustomHttpServletTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CustomHttpServletTestCase.java 16 Dec 2002 01:00:01 -0000 1.2
+++ CustomHttpServletTestCase.java 21 Dec 2002 19:34:44 -0000 1.3
@@ -63,10 +63,11 @@
// Create a servlet container
ServletHandler servlets = new ServletHandler();
- m_context.addHandler(servlets);
// Map a servlet onto the container
servlets.addServlet("Dump", "/Dump/*",
"org.apache.excalibur.altrmi.test.http.KludgeServlet");
+
+ m_context.addHandler(servlets);
// Serve static content from the context
// String home = System.getProperty("jetty.home", ".");
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>