Changeset 1991 for trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorServlet.java
- Timestamp:
- 07/08/15 09:03:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorServlet.java
r1561 r1991 33 33 * the servlet deployed in the web server that receives all recorded exchanges from the proxy. The 34 34 * exchanges are parsed and forwarded to the provided exchange handler. If an exchange can not 35 * be parsed it is discarded. Exchanges are only received via the POST HTTP method. 35 * be parsed it is discarded. Exchanges are only received via the POST HTTP method. Via the GET 36 * method, the servlet provides unique ordering ids as a header parameter in the response. The 37 * header parameter is named "X-AutoQUEST-OrderingId". For creating the ids it uses a provided id 38 * generator. 36 39 * </p> 37 40 * … … 47 50 */ 48 51 private transient HttpMonitorExchangeHandler exchangeHandler; 52 53 /** 54 * the id generator used to return new unique ids. 55 */ 56 private transient IdGenerator idGenerator; 49 57 50 58 /** 51 59 * <p> 52 60 * initializes the servlet with the exchange handler to which all exchanges shall be forwarded 61 * and the id generator to be used for returning new ids 53 62 * </p> 54 63 * 55 64 * @param exchangeHandler the exchange handler that shall receive all exchanges 65 * @param idGenerator the id generator used to generate new ids 56 66 */ 57 HttpMonitorServlet(HttpMonitorExchangeHandler exchangeHandler ) {67 HttpMonitorServlet(HttpMonitorExchangeHandler exchangeHandler, IdGenerator idGenerator) { 58 68 this.exchangeHandler = exchangeHandler; 69 this.idGenerator = idGenerator; 59 70 } 60 71 … … 87 98 } 88 99 } 100 101 /** 102 * this implements handling of doGet. For this servlet this means that we return a unique 103 * ordering id which can be used by proxies as ordering ids for requests and responses. 104 * 105 * (non-Javadoc) (non-Javadoc) 106 * @see HttpServlet#doGet(HttpServletRequest, HttpServletResponse) 107 */ 108 @Override 109 protected void doGet(HttpServletRequest request, HttpServletResponse response) 110 throws ServletException, IOException 111 { 112 response.setHeader("X-AutoQUEST-OrderingId", Long.toString(idGenerator.getNextId())); 113 } 89 114 90 115 }
Note: See TracChangeset
for help on using the changeset viewer.