Ignore:
Timestamp:
02/13/14 11:28:18 (10 years ago)
Author:
pharms
Message:
File:
1 edited

Legend:

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

    r1374 r1382  
    4444/** 
    4545 * <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. 
    4750 * </p> 
    4851 *  
     
    5255     
    5356    /** 
    54      *  
     57     * <p> 
     58     * the exchange handler to forward compiles exchanges to 
     59     * </p> 
    5560     */ 
    5661    private HttpMonitorExchangeHandler exchangeHandler; 
    5762     
    5863    /** 
    59      *  
     64     * <p> 
     65     * the request of compiled exchange 
     66     * </p> 
    6067     */ 
    6168    private HttpServletRequest request; 
    6269 
    6370    /** 
    64      *  
     71     * <p> 
     72     * the content of the request of compiled exchange 
     73     * </p> 
    6574     */ 
    6675    private List<ByteBuffer> requestData = new LinkedList<ByteBuffer>(); 
    6776     
    6877    /** 
    69      *  
     78     * <p> 
     79     * the response of compiled exchange 
     80     * </p> 
    7081     */ 
    7182    private HttpServletResponse response; 
    7283 
    7384    /** 
    74      *  
     85     * <p> 
     86     * the content of the response of compiled exchange 
     87     * </p> 
    7588     */ 
    7689    private List<ByteBuffer> responseData = new LinkedList<ByteBuffer>(); 
    7790     
    7891    /** 
    79      *  
     92     * <p> 
     93     * the last time an event for the exchange was received (used for supporting timeouts) 
     94     * </p> 
    8095     */ 
    8196    private long lastUpdate = System.currentTimeMillis(); 
    8297     
    8398    /** 
    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 
    85104     */ 
    86105    ExchangeListener(HttpMonitorExchangeHandler exchangeHandler) { 
     
    89108 
    90109    /** 
    91      *  
     110     * <p> 
     111     * called, when the request was received by the proxy 
     112     * </p> 
     113     *  
     114     * @param request the request of the exchange 
    92115     */ 
    93116    public void onRequest(HttpServletRequest request) throws IllegalStateException { 
     
    103126 
    104127    /** 
    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 
    106133     */ 
    107134    public void onRequestContent(ByteBuffer data) { 
     
    117144     
    118145    /** 
    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 
    120151     */ 
    121152    public void onResponse(HttpServletResponse response) { 
     
    131162     
    132163    /** 
    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 
    134169     */ 
    135170    public void onResponseContent(ByteBuffer data) { 
     
    145180     
    146181    /** 
    147      *  
     182     * <p> 
     183     * called, when proxy finished proxying a request 
     184     * </p> 
     185     *  
     186     * @param status the status of the proxying after finalization 
    148187     */ 
    149188    public void onFinish(Status status) { 
     
    159198     
    160199    /** 
    161      * @return the request 
     200     * @return the request of the exchange 
    162201     */ 
    163202    HttpServletRequest getRequest() { 
     
    166205 
    167206    /** 
    168      * 
     207     * @return the last time this listener received an event 
    169208     */ 
    170209    long getLastUpdate() { 
     
    173212 
    174213    /** 
    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 
    176220     */ 
    177221    private void sendToExchangeHandler(Status status) { 
     
    202246 
    203247    /** 
    204      * 
     248     * <p> 
     249     * convenience method to map an {@link HttpServletRequest} to an {@link HttpRequest} 
     250     * </p> 
    205251     */ 
    206252    private HttpRequest map(HttpServletRequest request, ObjectFactory eventObjectFactory) { 
     
    261307 
    262308    /** 
    263      * 
     309     * <p> 
     310     * convenience method to map an {@link HttpServletResponse} to an {@link HttpResponse} 
     311     * </p> 
    264312     */ 
    265313    private HttpResponse map(HttpServletResponse response, ObjectFactory eventObjectFactory) { 
     
    297345 
    298346    /** 
    299      * 
     347     * <p> 
     348     * convenience method to create a string out of recorded request or response content 
     349     * </p> 
    300350     */ 
    301351    private String createString(List<ByteBuffer> bufferList) { 
Note: See TracChangeset for help on using the changeset viewer.