<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    瘋狂

    STANDING ON THE SHOULDERS OF GIANTS
    posts - 481, comments - 486, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    spring httpinvoker 例子

    Posted on 2010-01-27 16:33 瘋狂 閱讀(2515) 評論(0)  編輯  收藏 所屬分類: spring

    1,創建接口:

    public interface HttpInvokerTestI {

     public TestPo getTestPo(String desp);
    }


    實現:

    public class HttpInvokertestImpl implements HttpInvokerTestI {

     @Override
     public TestPo getTestPo(String desp) {
      // TODO Auto-generated method stub
      return new TestPo(desp);
     }

    }


    配置:在web info下添加remote-servlet.xml

    內容:

     <bean name="httpinvokertest" class="ztest.httpinvoke.HttpInvokertestImpl"/>
         <bean name="/hit" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
            <property name="service" ref="httpinvokertest"/>
            <property name="serviceInterface" value="ztest.httpinvoke.HttpInvokerTestI"/>
         </bean>

    添加spring.jar spring-webmvc.jar(配置dispacherServlet用)
    web.xml 添加對context和servlet的支持:

    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>
       classpath:applicationContext-*.xml
      </param-value>
     </context-param>

     <listener>
      <listener-class>
       org.springframework.web.context.ContextLoaderListener
      </listener-class>
     </listener>



    <servlet>  
            <servlet-name>remote</servlet-name>  
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
                 <load-on-startup>1</load-on-startup>  
        </servlet>  
        <servlet-mapping>  
           <servlet-name>remote</servlet-name>  
           <url-pattern>/remoting/*</url-pattern>   
        </servlet-mapping> 

    客戶端配置:

    <bean id="remoteService"
        class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
           <property name="serviceUrl"
               value="http://localhost:8080/ssh/remoting/hit" />
           <property name="serviceInterface" value="com.s.httpinvoker.HttpInvokerTestI"/>

        </bean>

    測試類:
    public static void main(String[] args) {
      ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext-bean.xml");
      HttpInvokerTestI httpInvokerTestI = (HttpInvokerTestI) context.getBean("remoteService");
      System.out.println(httpInvokerTestI.getTestPo("dddd").getDesp());
      
     }

    完成。

    主站蜘蛛池模板: 九九久久国产精品免费热6| 2022年亚洲午夜一区二区福利| 亚洲专区中文字幕| 久久精品一本到99热免费| 亚洲A∨无码一区二区三区| 国产免费网站看v片在线| 亚洲成av人片一区二区三区| 免费一级毛片无毒不卡| 久久精品国产亚洲综合色| 免费不卡中文字幕在线| 永久免费av无码不卡在线观看 | 小草在线看片免费人成视久网| 久久影视国产亚洲| 拍拍拍无挡视频免费观看1000 | 亚洲人妻av伦理| 在线免费视频你懂的| 久久被窝电影亚洲爽爽爽| 一级毛片在线免费看| 亚洲国产福利精品一区二区| 在线免费观看色片| 香蕉视频在线观看免费| 国产AV无码专区亚洲AV手机麻豆 | 91精品免费国产高清在线| 在线aⅴ亚洲中文字幕| 吃奶摸下高潮60分钟免费视频| 九九免费观看全部免费视频| 亚洲色偷拍另类无码专区| 3d动漫精品啪啪一区二区免费 | 久久久受www免费人成| 亚洲91av视频| 四虎影院在线免费播放| 一个人免费观看日本www视频| 亚洲成av人在线视| 成年女人毛片免费播放人| 有色视频在线观看免费高清在线直播| 亚洲乱码一区二区三区在线观看| 亚洲精品免费在线| 美女被爆羞羞网站免费| 久久精品亚洲精品国产色婷 | 青青操免费在线观看| 亚洲一区动漫卡通在线播放|