⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.xtp

📁 RESIN 3.2 最新源码
💻 XTP
字号:
<document>  <header>    <product>resin</product>    <title>Hessian Service</title>    <description>      <p>Writing a Hessian service as a plain-old Java object (POJO)eliminates protocol dependencies and simplifies service testing.</p>    </description>    <type>tutorial</type>    <tutorial-startpage>demo.jsp</tutorial-startpage>  </header>  <body>    <summary/>    <s1><p>The <a href="../hessian-add/">addition example</a> built the Hessianservice as an extension of HessianService for simplicity.  Most serviceswill want to be independent of the Hessian protocol itself.</p></s1><s1 title="Files in this tutorial"><deftable><tr>  <th>File</th>  <th>Description</th></tr><tr>  <td><viewfile-link file="WEB-INF/classes/example/MathService.java"/></td>  <td>Interface for the math service.</td></tr><tr>  <td><viewfile-link file="WEB-INF/classes/example/MathServiceImpl.java"/></td>  <td>The main service implementation.</td></tr><tr>  <td><viewfile-link file="WEB-INF/resin-web.xml"/></td>  <td>Configures the environment</td></tr><tr>  <td><viewfile-link file="demo.jsp"/></td>  <td>Client JSP</td></tr><tr>  <td><viewfile-link file="demo.php"/></td>  <td>Client PHP</td></tr></deftable></s1><s1 title="Service Implementation"><p>The MathService implementation is just a Java class that implementsthe MatchService API.</p><example title="Example: MathServiceImpl.java">package example;public class MathServiceImpl implements MathService {  public int add(int a, int b)  {    return a + b;  }}</example></s1><s1 title="Remote Interface"><p>The Java interface describes the remote API.  This example has anaddition method, <var>add()</var>.</p><p>Resin's proxy client implementation uses the remote interface toexpose the API to the proxy stub.  Strictly speaking, though,the Java remote interface is not required for Hessian.  A non-Java clientwill not use the Java interface, except possibly as documentation.</p><example title="Example: MathService.java">package example;public interface MathService {  public int add(int a, int b);}</example></s1><s1 title="Service configuration"><example title="Example: resin-web.xml">&lt;web-app xmlns="http://caucho.com/ns/resin">  &lt;servlet-mapping url-pattern="/math/*"                   servlet-class="example.MathService">    &lt;protocol uri="hessian:"/>  &lt;/servlet-mapping>  &lt;remote-client name="math">    &lt;uri>hessian:url=${webApp.url}/math/&lt;/uri>    &lt;interface>example.MathService&lt;/interface>  &lt;/remote-client>&lt;/web-app></example></s1><s1 title="Java Client"><p>The client is identical to the basic example.</p><example title="Example: demo.jsp">&lt;%@ page import="javax.webbeans.In" %>&lt;%@ page import="example.MathService" %>&lt;%!@In MathService math;%>&lt;pre>3 + 2 = &lt;%= math.add(3, 2) %>3 - 2 = &lt;%= math.sub(3, 2) %>3 * 2 = &lt;%= math.mul(3, 2) %>3 / 2 = &lt;%= math.div(3, 2) %>&lt;/pre></example><results>3 + 2 = 53 - 2 = 13 * 2 = 63 / 2 = 1</results></s1><s1 title="PHP Client"><p>The client is identical to the basic example.</p><example title="Example: demo.php">&lt;?php$math = java_bean("math");?>&lt;pre>3 + 2 = &lt;?= $math->add(3, 2) ?>3 - 2 = &lt;?= $math->sub(3, 2) ?>3 * 2 = &lt;?= $math->mul(3, 2) ?>3 / 2 = &lt;?= $math->div(3, 2) ?>&lt;/pre></example><results>3 + 2 = 53 - 2 = 13 * 2 = 63 / 2 = 1</results></s1>  </body></document>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -