110 likes | 217 Views
Framework Presentation. Project Participants: Karun Biyani Manish Mehta Pradeep Vincent. CSE870 Advanced Software Engineering, Spring 2001 Instructor: Dr. B. Cheng. Overview . Proxy Domain Description Framework Overview Sample Application Highlights Demonstration
E N D
Framework Presentation Project Participants: Karun Biyani Manish Mehta Pradeep Vincent CSE870 Advanced Software Engineering, Spring 2001 Instructor: Dr. B. Cheng
Overview • Proxy Domain Description • Framework Overview • Sample Application Highlights • Demonstration • Discussion
Proxy Domain • Http Filtering Proxy • Proxy resides between client and server • Does intermediate action • Proxy uses: caching, filtering, etc. • Filtering: domain filtering, background filtering, ad filtering, block filtering, etc.
Framework Packages Error – Contains Exception Handling Routines Html – Contains Html Parser and Html Block. Html Block is used to store the parsed Html page. Http – Contains Files for Handling Http Request and Http Response. Filter – Contains Filter classes that will do filtering on Request or Response. All new filter applications have to create a new filter class which will inherit the FilterHandler class. Net – Contains Net Listener. It reads from and writes to the socket. Util – Contains files for generating Log File and Debug Routines Proxy – Contains Proxy Server and Http Proxy Handler
Framework Application
Application Highlights • Three Filtering Application • AdFilter • BlockFilter • BackgroundFilter • To instantiate the framework, the new filter class implements the FilterHandler interface and then instantiate the new filter class in Http1_0ProxyHandler
Code public class Http1_0ProxyHandler implements ISocketHandler { public static final String HTTP_URI_STRING = "http://"; private Socket m_sckOut = null; private NetObjRef tRefNextProxy = null; private boolean m_bDebug = false; private FilterHandler filter = new BackgroundFilter(); private static final boolean FLAG_REQ_FILTER = false; private static final boolean FLAG_RESP_FILTER = !FLAG_REQ_FILTER; private static final boolean DO_FILTER = true; public Http1_0ProxyHandler(FilterHandler applfilter) { filter = applfilter; }
import COM.reitshamer.http.*; import COM.reitshamer.html.*; public class AdFilter implements FilterHandler { public HttpResponse filter (HttpRequest req, HttpResponse res, boolean mayfilter) { if ( mayfilter ) { HTMLBlock block; if ( res != null ) HttpObjectList objList = res.getObjectList(); else return null; for ( int i=0; i < objList.size(); i++ ) { if ( objList.isHTMLBlock(i) ) { block = (HTMLBlock)objList.geti(i); dofiltering ( block ); } } } return null; }
Summary and Discussion • Framework Implementation • Fault Tolerance • Handling malformed URLs • Response Failure • Thinking Ahead - Timing Failure • Design Pattern • Iterator Pattern • Adapter Pattern
Summary and Discussion (contd.) • Proxy Understanding • How Http Request and Http Response are generated and Handled • Http Request and Response Headers • How different filtering can be implemented. • Working in Team