1 package org.mortbay.jetty.client; 2 3 import java.io.IOException; 4 5 import org.mortbay.io.Buffer; 6 7 public class HttpEventListenerWrapper implements HttpEventListener 8 { 9 HttpEventListener _listener; 10 boolean _delegating; 11 12 public HttpEventListenerWrapper() 13 { 14 _listener=null; 15 _delegating=false; 16 } 17 18 public HttpEventListenerWrapper(HttpEventListener eventListener,boolean delegating) 19 { 20 _listener=eventListener; 21 _delegating=delegating; 22 } 23 24 public HttpEventListener getEventListener() 25 { 26 return _listener; 27 } 28 29 public void setEventListener(HttpEventListener listener) 30 { 31 _listener = listener; 32 } 33 34 public boolean isDelegating() 35 { 36 return _delegating; 37 } 38 39 public void setDelegating(boolean delegating) 40 { 41 _delegating = delegating; 42 } 43 44 45 public void onConnectionFailed(Throwable ex) 46 { 47 if (_delegating) 48 _listener.onConnectionFailed(ex); 49 } 50 51 public void onException(Throwable ex) 52 { 53 if (_delegating) 54 _listener.onException(ex); 55 } 56 57 public void onExpire() 58 { 59 if (_delegating) 60 _listener.onExpire(); 61 } 62 63 public void onRequestCommitted() throws IOException 64 { 65 if (_delegating) 66 _listener.onRequestCommitted(); 67 } 68 69 public void onRequestComplete() throws IOException 70 { 71 if (_delegating) 72 _listener.onRequestComplete(); 73 } 74 75 public void onResponseComplete() throws IOException 76 { 77 if (_delegating) 78 _listener.onResponseComplete(); 79 } 80 81 public void onResponseContent(Buffer content) throws IOException 82 { 83 if (_delegating) 84 _listener.onResponseContent(content); 85 } 86 87 public void onResponseHeader(Buffer name, Buffer value) throws IOException 88 { 89 if (_delegating) 90 _listener.onResponseHeader(name,value); 91 } 92 93 public void onResponseHeaderComplete() throws IOException 94 { 95 if (_delegating) 96 _listener.onResponseHeaderComplete(); 97 } 98 99 public void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException 100 { 101 if (_delegating) 102 _listener.onResponseStatus(version,status,reason); 103 } 104 105 public void onRetry() 106 { 107 if (_delegating) 108 _listener.onRetry(); 109 } 110 111 112 113 }