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/ExchangeListenerManager.java

    r1381 r1382  
    3535/** 
    3636 * <p> 
    37  * TODO update comment 
    38  * The log manager handles different {@link HttpMonitorOutputWriter}s to perform the logging 
    39  * of recorded messages. It initializes a new writer if the first message for a specific 
    40  * client is received and it closes a writer if for a specific period of time no further message 
    41  * of the same client was received. The writers themselves consider log rotation. For handling 
    42  * messages, the {@link HttpMonitorExchangeHandler} mechanism provided by the 
    43  * {@link HttpMonitorServer} is used. 
     37 * {@link ExchangeListener}s need to be managed, as there is one instantiated for each proxied 
     38 * request/response. They need to be timed out, if for a longer time, no update is received. All 
     39 * this is done by the ExchangeListenerManager. 
    4440 * </p> 
    4541 *  
     
    5248 
    5349    /** 
     50     * <p> 
    5451     * the timeout after which a writer of an inactive client is closed 
     52     * </p> 
    5553     */ 
    5654    private static final int SESSION_TIMEOUT = 10 * 60 * 1000; 
    5755     
    5856    /** 
    59      *  
     57     * <p> 
     58     * the exchange handler forwarded to the exchange listeners 
     59     * </p> 
    6060     */ 
    6161    private HttpMonitorExchangeHandler exchangeHandler; 
    6262     
    6363    /** 
    64      * the mapping of client ids to the respective writers. 
     64     * <p> 
     65     * the mapping of requests handled by the proxy to the respective exchange listeners 
     66     * </p> 
    6567     */ 
    6668    private Map<HttpServletRequest, ExchangeListener> listeners; 
    6769 
    6870    /** 
    69      * a timer used to detect exchange timeouts 
     71     * <p> 
     72     * a timer used to detect exchange listener timeouts 
     73     * </p> 
    7074     */ 
    7175    private Timer listenerTimer; 
    7276 
    7377    /** 
    74      * 
    75      * 
     78     * <p> 
     79     * creates the exchange listener manager with the exchange handler to be forwarded to the 
     80     * exchange listeners 
     81     * </p> 
     82     *  
     83     * @param exchangeHandler the exchange handler to be forwarded to the exchange listeners 
    7684     */ 
    7785    ExchangeListenerManager(HttpMonitorExchangeHandler exchangeHandler) { 
     
    130138 
    131139    /** 
    132      *  
     140     * <p> 
     141     * called, when the request was received by the proxy. Calls the appropriate method on 
     142     * the exchange listener. 
     143     * </p> 
     144     *  
     145     * @param request the request of the exchange 
    133146     */ 
    134147    public void onRequest(HttpServletRequest request) throws IllegalStateException { 
     
    137150 
    138151    /** 
    139      *  
     152     * <p> 
     153     * called, when some content of the request was processed by the proxy. Calls the appropriate 
     154     * method on the exchange listener. 
     155     * </p> 
     156     *  
     157     * @param request the request of the exchange 
     158     * @param data    the processed content of the request of the exchange 
    140159     */ 
    141160    public void onRequestContent(HttpServletRequest request, ByteBuffer data) 
     
    146165 
    147166    /** 
    148      *  
     167     * <p> 
     168     * called, when the response is to be returned by the proxy. Calls the appropriate 
     169     * method on the exchange listener. 
     170     * </p> 
     171     *  
     172     * @param request  the request of the exchange 
     173     * @param response the response of the exchange 
    149174     */ 
    150175    public void onResponse(HttpServletRequest request, HttpServletResponse response) 
     
    155180 
    156181    /** 
    157      *  
     182     * <p> 
     183     * called, when some content of the response was processed by the proxy. Calls the appropriate 
     184     * method on the exchange listener. 
     185     * </p> 
     186     *  
     187     * @param request the request of the exchange 
     188     * @param data    the processed content of the response of the exchange 
    158189     */ 
    159190    public void onResponseContent(HttpServletRequest request, ByteBuffer data) 
     
    164195 
    165196    /** 
    166      *  
     197     * <p> 
     198     * called, when proxy finished proxying a request. Calls the appropriate method on the 
     199     * exchange listener and afterwards cleans up the listener. 
     200     * </p> 
     201     *  
     202     * @param request the request of the exchange 
     203     * @param status  the status of the proxying after finalization 
    167204     */ 
    168205    public void onFinish(HttpServletRequest request, Status status) throws IllegalStateException { 
     
    173210 
    174211    /** 
    175      * 
     212     * <p> 
     213     * convenience method to ensure a listener for a specific HTTP servlet request to be handled. 
     214     * </p> 
    176215     */ 
    177216    private ExchangeListener ensureListener(HttpServletRequest request) { 
     
    194233    /** 
    195234     * <p> 
    196      * internal timer task used for detecting session timeouts of clients 
     235     * internal timer task used for detecting exchange timeouts 
    197236     * </p> 
    198237     *  
Note: See TracChangeset for help on using the changeset viewer.