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

    完成。

    主站蜘蛛池模板: 国产网站在线免费观看| 又长又大又粗又硬3p免费视频| 亚洲国产一级在线观看| 亚洲高清免费在线观看| 中文字幕无线码中文字幕免费| 亚洲AV噜噜一区二区三区| 精品亚洲麻豆1区2区3区| 国产亚洲大尺度无码无码专线 | 国产成人免费一区二区三区| 日韩精品久久久久久免费| 亚洲精品黄色视频在线观看免费资源 | 亚洲国产成人VA在线观看| 国产精品视频免费一区二区| 91嫩草免费国产永久入口| 国产精品99久久免费观看| 人成午夜免费大片在线观看| 韩国亚洲伊人久久综合影院| 久久乐国产综合亚洲精品| 亚洲国产日韩在线成人蜜芽 | 日本卡1卡2卡三卡免费| 一本一道dvd在线观看免费视频| 亚洲精品无码永久在线观看男男 | aⅴ免费在线观看| 99热这里只有精品免费播放| 在线人成免费视频69国产| 国产在线观看免费视频软件| www.av在线免费观看| 黄色a三级免费看| 曰批免费视频播放免费| 无码人妻一区二区三区免费视频 | 免费一级毛片在线播放| 国产一级一片免费播放| 啊v在线免费观看| 亚洲AV无码一区二区三区国产| 天堂亚洲免费视频| 亚洲精品国产va在线观看蜜芽| 四虎亚洲国产成人久久精品| 亚洲欧洲中文日韩久久AV乱码| 亚洲午夜无码AV毛片久久| 91麻豆精品国产自产在线观看亚洲| 亚洲女人被黑人巨大进入|