Author: asankha
Date: Sun Mar 4 21:51:42 2007
New Revision: 514554
URL: http://svn.apache.org/viewvc?view=rev&rev=514554
Log:
update NIO transport to write back custom http headers set on the Axis2 message
context and to make the remote party IP address available to the Axis2 MC for
incoming requests
Modified:
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerWorker.java
Modified:
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java?view=diff&rev=514554&r1=514553&r2=514554
==============================================================================
---
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
(original)
+++
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/Axis2HttpRequest.java
Sun Mar 4 21:51:42 2007
@@ -33,6 +33,8 @@
import java.io.OutputStream;
import java.nio.channels.Pipe;
import java.nio.channels.Channels;
+import java.util.Map;
+import java.util.Iterator;
/**
* Represents an outgoing Axis2 HTTP/s request. It holds the EPR of the
destination, the
@@ -82,6 +84,21 @@
public HttpRequest getRequest() {
HttpPost httpRequest = new HttpPost(epr.getAddress());
httpRequest.setEntity(new BasicHttpEntity());
+
+ // set any transport headers
+ Object o = msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+ if (o != null && o instanceof Map) {
+ Map headers = (Map) o;
+ Iterator iter = headers.keySet().iterator();
+ while (iter.hasNext()) {
+ Object header = iter.next();
+ Object value = headers.get(header);
+ if (header instanceof String && value != null && value
instanceof String) {
+ httpRequest.setHeader((String) header, (String) value);
+ }
+ }
+ }
+
return httpRequest;
}
Modified:
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java?view=diff&rev=514554&r1=514553&r2=514554
==============================================================================
---
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java
(original)
+++
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerHandler.java
Sun Mar 4 21:51:42 2007
@@ -162,6 +162,10 @@
}
}
+ public void responseReady(NHttpServerConnection conn) {
+ // New API method - should not require
+ }
+
/**
* Process ready output by writing into the channel
* @param conn the connection being processed
Modified:
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerWorker.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerWorker.java?view=diff&rev=514554&r1=514553&r2=514554
==============================================================================
---
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerWorker.java
(original)
+++
webservices/synapse/branches/0.92-SNAPSHOT/modules/nhttp/src/org/apache/axis2/transport/nhttp/ServerWorker.java
Sun Mar 4 21:51:42 2007
@@ -127,6 +127,11 @@
headers.put(headerArr[i].getName(), headerArr[i].getValue());
}
msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headers);
+ // find the remote party IP address and set it to the message context
+ if (conn instanceof HttpInetConnection) {
+ HttpInetConnection inetConn = (HttpInetConnection) conn;
+ msgContext.setProperty(MessageContext.REMOTE_ADDR,
inetConn.getRemoteAddress());
+ }
try {
msgContext.setTransportOut(cfgCtx.getAxisConfiguration()
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]