A document has been updated: http://cocoon.zones.apache.org/daisy/documentation/1412.html
Document ID: 1412 Branch: main Language: default Name: Overview (unchanged) Document Type: Cocoon Document (unchanged) Updated on: 1/12/08 8:43:01 PM Updated by: Grzegorz Kossakowski A new version has been created, state: publish Parts ===== Content ------- This part has been updated. Mime type: text/xml (unchanged) File name: (unchanged) Size: 5554 bytes (previous version: 2982 bytes) Content diff: (71 equal lines skipped) <li>Request's path is passed untouched.</li> </ul> +++ <h2>Inheritance and polymorphism</h2> +++ +++ <p>Servlet can act as component thus it can extend other one and override it's +++ resource (request) handling. Nothing wrong is here, it's really about overriding +++ resource handling not methods of class implementing servlet interface. If it was +++ normal inheritance and polymorhism of classes then there would be no room for +++ innovation, Java has it all since 1.0 version.<br/> +++ Servlet Service Framework cares only about <strong>resources</strong> +++ (identified by URLs) particular servlet can handle and not about implementation +++ of servlet class. Basically, it means that all widely known concepts of Object +++ Oriented Programming are applied to resources. In order to help you understand +++ how various notions map from OOP to Resource Oriented Architecture (ROA) take a +++ look at following table:</p> +++ +++ <table> +++ <tbody> +++ <tr> +++ <th> +++ <p>Object Oriented Programming</p> +++ </th> +++ <th> +++ <p>Resource Oriented Architecture</p> +++ </th> +++ <th> +++ <p>Remarks</p> +++ </th> +++ </tr> +++ <tr> +++ <td> +++ <p>calling <tt>getFooBar()</tt> method</p> +++ </td> +++ <td> +++ <p>requesting <tt>/fooBar</tt> resource</p> +++ </td> +++ <td> +++ <p>for making request HTTP GET method is used</p> +++ </td> +++ </tr> +++ <tr> +++ <td> +++ <p>calling <tt>getFooBar(value1, value2)</tt> method</p> +++ </td> +++ <td> +++ <p>requesting <tt>/fooBar?param1=value1&param2=value2</tt> resource</p> +++ </td> +++ <td> +++ <p>if one of parameters contains binary data, then POST (or PUT but we won't get +++ into details too much here) request is being made</p> +++ </td> +++ </tr> +++ <tr> +++ <td><tt>classB</tt> +++ <p>extends <tt>classA</tt></p> +++ </td> +++ <td><tt>servletB</tt> +++ <p>connects to <tt>servletA</tt> using connection named <tt>super</tt></p> +++ </td> +++ <td> +++ <p>Connection named "super" is reserved for inheritance implementation</p> +++ </td> +++ </tr> +++ <tr> +++ <td valign="top"><tt>classA</tt> +++ <p>implements <tt>interfaceB</tt></p> +++ </td> +++ <td valign="top"> +++ <p>N/A</p> +++ </td> +++ <td valign="top"> +++ <p>Servlet Service Framework does no have any equivalent for strong typing known +++ from programming languages so it cannot check if equivalent of interface is +++ being implemented.<br/> +++ The interface concept known from OOP maps best to just an abstract contract. +++ It's a servletA's contract to handle various resources but check if it really +++ does can be made at runtime only. It's similar situation to scripting languages +++ like Javascript.</p> +++ </td> +++ </tr> +++ <tr> +++ <td valign="top"><tt>classB</tt> +++ <p>overrides method <tt>getFooBar()</tt> implemented in <tt>classA</tt></p> +++ </td> +++ <td valign="top"><tt>servletB</tt> +++ <p>implements handling of <tt>/fooBar</tt> resource.</p> +++ </td> +++ <td valign="top"/> +++ </tr> +++ </tbody> +++ </table> +++ </body> </html>