Ignore:
Timestamp:
07/08/15 09:03:46 (9 years ago)
Author:
pharms
Message:
  • added ordering id for requests and responses
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/HttpMonitorServlet.java

    r1561 r1991  
    3333 * the servlet deployed in the web server that receives all recorded exchanges from the proxy. The 
    3434 * 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. 
    3639 * </p> 
    3740 *  
     
    4750     */ 
    4851    private transient HttpMonitorExchangeHandler exchangeHandler; 
     52     
     53    /** 
     54     * the id generator used to return new unique ids. 
     55     */ 
     56    private transient IdGenerator idGenerator; 
    4957 
    5058    /** 
    5159     * <p> 
    5260     * 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 
    5362     * </p> 
    5463     * 
    5564     * @param exchangeHandler the exchange handler that shall receive all exchanges 
     65     * @param idGenerator     the id generator used to generate new ids 
    5666     */ 
    57     HttpMonitorServlet(HttpMonitorExchangeHandler exchangeHandler) { 
     67    HttpMonitorServlet(HttpMonitorExchangeHandler exchangeHandler, IdGenerator idGenerator) { 
    5868        this.exchangeHandler = exchangeHandler; 
     69        this.idGenerator = idGenerator; 
    5970    } 
    6071 
     
    8798        } 
    8899    } 
     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    } 
    89114     
    90115} 
Note: See TracChangeset for help on using the changeset viewer.