Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among these components. Data flow analysis is useful for debugging when errors occurred. Traditional methods are, however, insufficient for data flow analysis in web applications. We define data dependence relations between components and inside components and integrate these relations as data dependency for web applications. Our target web applications are constructed using Servlet and JSP. We show a data dependency graph for a simple web application as example. 1 Web Web Web Web Web Web [2] JSP [3] Web Java Web Web 2 Web Web Web HTTP HTTP Web Sho Kurokawa, Hiroaki Kuwabara, Shinichiro Yamamoto, Kiyoshi Agusa,
FOSE2005 HTML HTTP ASP JSP PHP Web Web JSP MVC Web Web JSP Web 1 ( ) JSP Web Java [6] 2 Web 3 A B B A B A B C 1 1. A C 2. A B 3. B C 3 1 C C C C A B 1
A Data Dependency Graph for Web Applications 2 1. 2. 1. Web Struts [1] Web Struts Web Web 3.1 2 1. HTTP 2. 1. URI POST?name0=value0&name1=value1& HTML 1. 2. ServletRequest setattribute( name,obj) getattribute( name ) setattribute obj name name obj 2. 3.2 3.1 2 ( ) name namespace (name, namespace) namespace = P arameter namespace c = (name, namespace) c = (name, namespace ) c = c name = name namespace = namespace
FOSE2005 1 1 re- 1 request.getparameter( name ) request.getparametervalues( name ) request.getattribute( name ) jsp:usebean id= name scope= request class= BeanClass / samplebean.getname() jsp:getproperty name= SampleBean property= name / form action= url method= post input type= text name= name / /form a href= url?name=value request.setattribute( name, expr) samplebean.setname(expr) jsp:setproperty name= SampleBean property= name value= %= expr % / ( name, Parameter ) ( name, HttpServletRequest ) ( name, SampleBean ) ( name, Parameter ) ( name, HttpServletRequest ) ( name, SampleBean ) quest HttpServletRequest samplebean SampleBean Bean 1 HTML Bean 1 Bean JSP 1 4 4.1 2 3 ( ) A B A B A CA out B CB in c a = c b CA out c a C B in c b
A Data Dependency Graph for Web Applications 4.2 Java 1 Java 2 1 2 2 OSDG [6] OSDG Java OSDG x 2 e 1, e 2 3 Def-Use e 1 x e 2 x e 1 e 2 x e 1 e 2 String expr = request.getparameter("name"); 1 ( name, Parameter ) expr expr ( name, Parameter ) 4 ( ) S 1 S 2 S S =S 1 S2 4.3 Web Web 5 (Web ) Web W W = S(RS) i i R S A e a B e b e a e b 5 Web 6 (Web ) G G = (V, E) V = C E x 1 JSP JSP Java
FOSE2005 E = {(e a, e b ) e a, e b E x. (e a, e b ) S 1 } {(c, e) c C. e E x. (c, e) S 2 } {(e, c) e E x. c C. (e, c) S 2 } {(c a, c b ) c a, c b C. (c a, c b ) R} C E x R S 1 S 2 5 Web Web index.jsp CalCircle.java result.jsp Web index.jsp CalCircle.java result.jsp 2 Web 5.1 Web index.jsp CalCircle.java CalCircle.java result.jsp 3 index.jsp CalCircle.java CalCircle.java result.jsp <form action="calcircle" method="post"> <input type="text" name="radius" /><br /> (1) <input type="radio" name="option" value="round" checked /> (2) <input type="radio" name="option" value="area" /><br /><br /> <input type="submit" value="submit" /> </form> 3 index.jsp 3 4 5 2 Web (1) (12) 2 (1) (12) c 1 c 12 2 3 R = {(c 1, c 3 ), (c 2, c 4 ), (c 8, c 9 ), (c 5, c 10 ), (c 6, c 11 ), (c 7, c 12 )}
A Data Dependency Graph for Web Applications 01: public void dopost(httpservletrequest request, 02: HttpServletResponse response) 03: throws IOException, ServletException { 04: RadiusBeans bean = new RadiusBeans(); 05: String radius = request.getparameter("radius"); (3) 06: double r = Integer.parseInt(radius); 07: String option = request.getparameter("option"); (4) 08: double result = 0; 09: if (option.equals("round")) { 10: result = 2 * r * Math.PI; 11: } else { 12: result = r * r * Math.PI; 13: } 14: bean.setradius(r); (5) 15: bean.setoption(option); (6) 16: bean.setresult(result); (7) 17: request.setattribute("beanobj",bean); (8) 18: } 4 CalCircle.java <jsp:usebean id="beanobj" scope="request" class="radiusbeans" /> (9). <jsp:getproperty name="beanobj" property="radius" /> (10) <jsp:getproperty name="beanobj" property="option" /> (11) : <jsp:getproperty name="beanobj" property="result" /> (12) 5 result.jsp 2 index.jsp (1) ( radius, Parameter ) (2) ( option, Parameter ) CalCircle.java (3) ( radius, Parameter ) (4) ( option, Parameter ) (5) ( radius, RadiusBeans ) (6) ( option, RadiusBeans ) (7) ( result, RadiusBeans ) (8) ( beanobj, HttpServletRequest ) result.jsp (9) ( beanobj, HttpServletRequest ) (10) ( radius, RadiusBeans ) (11) ( option, RadiusBeans ) (12) ( result, RadiusBeans ) 5.2 Web 6 Web 6 4 : S S 1 S 2 S 1 10
FOSE2005 r ( 10:r ) 10:r 06:r 06:r 10:r 10:r 10:result 10:r 10:result S 2 17 bean ( 17:bean ) 17 (8) setattribute (8) 17:bean 17:bean (8) CalCircle.java Java index.jsp ( 6 (1)) CalCircle.java result result result.jsp CalCircle.java result.jsp result.jsp index.jsp 2 Web Option Option (2) (4) Radius 07:option 15:option (6) (11) Radius (1) (3) index.jsp 05:radius 06:radius 06:r 04:bean 14:r 17:bean (5) (8) (10) Bean (9) Result R 16:result (7) (12) S1 S2 10:r 12:r 12:r result.jsp Component Variable 08:result 12:result expression 10:result CalCircle.java 6 2 Web 6 CASE Sapid [7] Strus Web 1. Web 2. JSP struts-config.xml 3.
A Data Dependency Graph for Web Applications 4. 2,3 5. OSDG 6. 4,5 Web Web 7 Web 8 8 result.jsp result Web result result Web index Input two data Add or Sub 7 Calc Action error result Output Result 8 result.jsp CalcAction result CalcAction result.jsp result CalcAction index.jsp arg1 CalcAction index.jsp arg2 index.jsp CalcAction arg1 index.jsp CalcAction arg2 7 7.1 Web Web 2 Web Struts Web Web Web Web Web
FOSE2005 7.2 Ricca Web [4] Web HTML Taguchi Web Web [5] Web Web Web 7.3 JSP Web EJB DBMS JSP Web EJB EJB e-society WebWare [1] The Apache Software Foundation. The Apache Struts Web Application Framework. http://struts.apache.org/. [2] Sun Microsystems. Java Servlet Technology. http://java.sun.com/products/servlet/. [3] Sun Microsystems. JavaServer Pages Technology. http://java.sun.com/products/jsp/. [4] Filippo Ricca and Paolo Tonella. Web Application Slicing. In ICSM 01, pages 148 157. IEEE Computer Society, 2001. [5] Mitsuhisa Taguchi, Tetsuya Suzuki, and Takehiro Tokuda. A Visual Approach for Generating Server Page Type Web Applications Based on Template Method. In Proceedings of the 2003 IEEE Symposium on Visual and Multimedia Software Engineering, pages 248 250. IEEE Computer Society, 2003. [6],,.., 40(4):1851 1860, 1999. [7],,. CASE Sapid., 39(6):1990 1998, 1998.