<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 瘋狂 閱讀(2508) 評論(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());
      
     }

    完成。

    主站蜘蛛池模板: 国产日韩在线视频免费播放| 午夜时刻免费入口| 亚洲一区二区三区免费| 免费看黄网站在线看| 国产免费直播在线观看视频| 亚洲Av无码国产一区二区| 国产美女无遮挡免费视频| 男女超爽视频免费播放| 国产中文字幕免费观看| 未满十八私人高清免费影院| 亚洲天堂免费在线视频| a级毛片毛片免费观看永久| 亚洲VA中文字幕不卡无码| 午夜免费福利片观看| 亚洲最新在线视频| 在线免费观看一级毛片| 自拍偷自拍亚洲精品播放| www.亚洲精品| 国内精品免费在线观看| 久久亚洲日韩看片无码| 成年人免费观看视频网站| 成人久久久观看免费毛片| 亚洲av无码不卡| 国产成人免费在线| 亚洲av片在线观看| 亚洲中文字幕伊人久久无码| 久久国产精品免费视频| ASS亚洲熟妇毛茸茸PICS| 亚洲AV无码一区二三区| 日韩免费电影网址| 亚洲综合激情五月色一区| 无码欧精品亚洲日韩一区夜夜嗨 | 78成人精品电影在线播放日韩精品电影一区亚洲 | 四虎成人免费观看在线网址| 久久人午夜亚洲精品无码区| 亚洲一区精品无码| 毛片免费vip会员在线看| 久久久久久久久久免免费精品| 亚洲女人影院想要爱| 亚洲国产成人久久精品99| **俄罗斯毛片免费|