<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 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    spring httpinvoker 例子

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

    1,創(chuàng)建接口:

    public interface HttpInvokerTestI {

     public TestPo getTestPo(String desp);
    }


    實現(xiàn):

    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

    內(nèi)容:

     <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());
      
     }

    完成。

    主站蜘蛛池模板: 亚洲人成影院在线观看| 在线永久免费观看黄网站| 久久亚洲高清观看| 久久国产福利免费| 亚洲精品国自产拍在线观看| 男女猛烈xx00免费视频试看| 国产成人免费片在线观看| 美女被免费网站视频在线| 亚洲国产成人精品女人久久久 | 色拍自拍亚洲综合图区| 99久久99久久精品免费观看| 亚洲福利秒拍一区二区| 青青草免费在线视频| 亚洲乱码av中文一区二区| 国产jizzjizz免费看jizz| 春意影院午夜爽爽爽免费| 亚洲欧洲日产国码av系列天堂| 好男人资源在线WWW免费| 亚洲欧洲日韩不卡| 一二三四在线观看免费高清中文在线观看| 亚洲中文字幕一二三四区| 高清在线亚洲精品国产二区| 人人爽人人爽人人片av免费| 亚洲国产日韩在线视频| 18以下岁毛片在免费播放| 亚洲精品乱码久久久久蜜桃 | 波多野结衣免费视频观看 | 亚洲一区二区三区在线| 麻豆国产VA免费精品高清在线| 黄人成a动漫片免费网站| 亚洲精品无码MV在线观看 | 一本久到久久亚洲综合| 任你躁在线精品免费| 亚洲丝袜中文字幕| 亚洲av再在线观看| 亚洲第一网站免费视频| 在线观看亚洲网站| 亚洲综合色丁香麻豆| 免费国产成人高清在线观看麻豆 | 你好老叔电影观看免费| 亚洲中文字幕无码爆乳app|