Changeset 1382 for trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/ExchangeListener.java
- Timestamp:
- 02/13/14 11:28:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/ExchangeListener.java
r1374 r1382 44 44 /** 45 45 * <p> 46 * TODO comment 46 * recording an exchange can not be done in one step. This is due to the fact, that the proxy 47 * servlet notifies different processing states for requests and response. An exchange listener 48 * records all these event. On the occurrence of the final event, it compiles an 49 * {@link HttpExchange} and forwards it to the exchange handler. 47 50 * </p> 48 51 * … … 52 55 53 56 /** 54 * 57 * <p> 58 * the exchange handler to forward compiles exchanges to 59 * </p> 55 60 */ 56 61 private HttpMonitorExchangeHandler exchangeHandler; 57 62 58 63 /** 59 * 64 * <p> 65 * the request of compiled exchange 66 * </p> 60 67 */ 61 68 private HttpServletRequest request; 62 69 63 70 /** 64 * 71 * <p> 72 * the content of the request of compiled exchange 73 * </p> 65 74 */ 66 75 private List<ByteBuffer> requestData = new LinkedList<ByteBuffer>(); 67 76 68 77 /** 69 * 78 * <p> 79 * the response of compiled exchange 80 * </p> 70 81 */ 71 82 private HttpServletResponse response; 72 83 73 84 /** 74 * 85 * <p> 86 * the content of the response of compiled exchange 87 * </p> 75 88 */ 76 89 private List<ByteBuffer> responseData = new LinkedList<ByteBuffer>(); 77 90 78 91 /** 79 * 92 * <p> 93 * the last time an event for the exchange was received (used for supporting timeouts) 94 * </p> 80 95 */ 81 96 private long lastUpdate = System.currentTimeMillis(); 82 97 83 98 /** 84 * 99 * <p> 100 * initialized the exchange listener with the exchange handler to forward compiled exchanges to 101 * </p> 102 * 103 * @param exchangeHandler the exchange handler to forward compiled exchanges to 85 104 */ 86 105 ExchangeListener(HttpMonitorExchangeHandler exchangeHandler) { … … 89 108 90 109 /** 91 * 110 * <p> 111 * called, when the request was received by the proxy 112 * </p> 113 * 114 * @param request the request of the exchange 92 115 */ 93 116 public void onRequest(HttpServletRequest request) throws IllegalStateException { … … 103 126 104 127 /** 105 * 128 * <p> 129 * called, when some content of the request was processed by the proxy 130 * </p> 131 * 132 * @param data the processed content of the request of the exchange 106 133 */ 107 134 public void onRequestContent(ByteBuffer data) { … … 117 144 118 145 /** 119 * 146 * <p> 147 * called, when the response is to be returned by the proxy 148 * </p> 149 * 150 * @param response the response of the exchange 120 151 */ 121 152 public void onResponse(HttpServletResponse response) { … … 131 162 132 163 /** 133 * 164 * <p> 165 * called, when some content of the response was processed by the proxy 166 * </p> 167 * 168 * @param data the processed content of the response of the exchange 134 169 */ 135 170 public void onResponseContent(ByteBuffer data) { … … 145 180 146 181 /** 147 * 182 * <p> 183 * called, when proxy finished proxying a request 184 * </p> 185 * 186 * @param status the status of the proxying after finalization 148 187 */ 149 188 public void onFinish(Status status) { … … 159 198 160 199 /** 161 * @return the request 200 * @return the request of the exchange 162 201 */ 163 202 HttpServletRequest getRequest() { … … 166 205 167 206 /** 168 * 207 * @return the last time this listener received an event 169 208 */ 170 209 long getLastUpdate() { … … 173 212 174 213 /** 175 * 214 * <p> 215 * convenience method to compile an {@link HttpExchange} and send it to the exchange handler 216 * after finalization of the exchange. 217 * </p> 218 * 219 * @param status the status of the proxying after finalization 176 220 */ 177 221 private void sendToExchangeHandler(Status status) { … … 202 246 203 247 /** 204 * 248 * <p> 249 * convenience method to map an {@link HttpServletRequest} to an {@link HttpRequest} 250 * </p> 205 251 */ 206 252 private HttpRequest map(HttpServletRequest request, ObjectFactory eventObjectFactory) { … … 261 307 262 308 /** 263 * 309 * <p> 310 * convenience method to map an {@link HttpServletResponse} to an {@link HttpResponse} 311 * </p> 264 312 */ 265 313 private HttpResponse map(HttpServletResponse response, ObjectFactory eventObjectFactory) { … … 297 345 298 346 /** 299 * 347 * <p> 348 * convenience method to create a string out of recorded request or response content 349 * </p> 300 350 */ 301 351 private String createString(List<ByteBuffer> bufferList) {
Note: See TracChangeset
for help on using the changeset viewer.