|
26 | 26 | import org.apache.commons.httpclient.params.HttpConnectionManagerParams; |
27 | 27 | import org.apache.commons.httpclient.params.HttpMethodParams; |
28 | 28 | import org.w3c.dom.Document; |
29 | | - |
30 | 29 | import javax.xml.parsers.DocumentBuilder; |
31 | 30 | import javax.xml.transform.TransformerConfigurationException; |
32 | 31 | import javax.xml.transform.TransformerException; |
|
37 | 36 | import java.net.ProtocolException; |
38 | 37 | import java.util.ArrayList; |
39 | 38 | import java.util.List; |
40 | | - |
| 39 | +import java.util.List; |
| 40 | +import org.apache.commons.httpclient.Header; |
| 41 | +import java.util.ArrayList; |
| 42 | +import java.util.Arrays; |
41 | 43 | /** |
42 | 44 | * Class helps in posting the Request document for the Transaction using HttpClient. |
43 | 45 | * Converts the document to String format and also helps in setting up the Proxy connections. |
@@ -81,7 +83,8 @@ void postDocument(Document request) |
81 | 83 |
|
82 | 84 | postMethod.setRequestEntity( |
83 | 85 | new StringRequestEntity(requestString, null, "UTF-8")); |
84 | | - |
| 86 | + postMethod.setRequestHeader(Utility.ORIGIN_TIMESTAMP, String.valueOf(System.currentTimeMillis())); |
| 87 | + logRequestHeaders(); |
85 | 88 | httpClient.executeMethod(postMethod); |
86 | 89 | } |
87 | 90 |
|
@@ -231,6 +234,19 @@ public boolean retryMethod( |
231 | 234 | return false; |
232 | 235 | } |
233 | 236 | } |
| 237 | + |
| 238 | + @Override |
| 239 | + public void logRequestHeaders() { |
| 240 | + List<Header> reqheaders=Arrays.asList(postMethod.getRequestHeaders()); |
| 241 | + logger.log(Logger.LT_INFO, "Request Headers: " +reqheaders); |
| 242 | + } |
| 243 | + |
| 244 | + @Override |
| 245 | + public void logResponseHeaders() { |
| 246 | + List<Header> respheaders=Arrays.asList(postMethod.getResponseHeaders()); |
| 247 | + logger.log(Logger.LT_INFO, "Response Headers"+ respheaders); |
| 248 | + } |
| 249 | + |
234 | 250 | } |
235 | 251 |
|
236 | 252 | /* Copyright 2006 CyberSource Corporation */ |
|
0 commit comments