日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

gwt api_使用RequestFactory API进行Spring GWT集成

發(fā)布時間:2023/12/3 javascript 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 gwt api_使用RequestFactory API进行Spring GWT集成 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

gwt api

從GWT 2.4開始,將RequestFactory API與后端的Spring服務(wù)集成很容易,您需要做的就是在服務(wù)器上創(chuàng)建一個自定義ServiceLocator,GWT將使用它來正確定位被調(diào)用的服務(wù):

public class SpringServiceLocator implements ServiceLocator {public Object getInstance(Class clazz) {ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(RequestFactoryServlet.getThreadLocalServletContext());return context.getBean(clazz);} }

第二步是像這樣在web.xml上聲明您的RequestFactory servlet,(我假設(shè)您已經(jīng)進行了彈簧設(shè)置):

<servlet><servlet-name>requestFactoryServlet</servlet-name><servlet-class>org.gxpenses.util.SpringRequestServlet</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>requestFactoryServlet</servlet-name><url-pattern>/gwtRequest</url-pattern></servlet-mapping>

和GWT一樣,您必須配置代理(因為使用服務(wù)樣式后端,因此必須使用ValueProxy而不是EntityProxy)和作為服務(wù)遠程接口的請求:

//Note that I inherit from the ValueProxy object@ProxyFor(Account.class)public interface AccountProxy extends ValueProxy {public String getId();public void setId(String id);public String getName();public void setName(String name);public Double getBalance();public void setBalance(Double balance);public String getType();public void setType(String type);}//You have to provide you service Impl class, and the ServiceLocator you created//Note that Account is automatically to AccountProxy on the client@Service(value=AccountsServiceImpl.class, locator=SpringServiceLocator.class)public interface AccountRequest extends RequestContext {abstract Request<Void> createNewAccount(AccountProxy account);abstract Request<Void> updateAccountBalance(String accountId, Double transactionAmount, String type);abstract Request<Double> totalAmountByAccountAndPeriodeAndType(String accountId, Date start, Date end, String type);}

集成就是這樣,有關(guān)如何使用RequestFactory API的更多信息,請參見: RequestFactory API

參考: Fancy UI博客中的JCG合作伙伴 Idriss Mrabti 使用RequestFactory API進行的Spring GWT集成 。

相關(guān)文章 :

  • GWT 2 Spring 3 JPA 2 Hibernate 3.5教程– Eclipse和Maven 2展示
  • GWT 2 Spring 3 JPA 2 Hibernate 3.5教程
  • 建立自己的GWT Spring Maven原型
  • 使用Spring 3.1和基于Java的配置引導(dǎo)Web應(yīng)用程序,第1部分
  • GWT Spring和Hibernate進入數(shù)據(jù)網(wǎng)格世界
  • 使用Selenium或WebDriver測試GWT應(yīng)用
  • GWT,GWT-Ext(SmartGWT),GXT(Ext GWT)常見任務(wù)
  • GWT EJB3 Maven JBoss 5.1集成教程
  • SmartGWT入門,提供出色的GWT界面

翻譯自: https://www.javacodegeeks.com/2011/12/spring-gwt-integration-using.html

gwt api

總結(jié)

以上是生活随笔為你收集整理的gwt api_使用RequestFactory API进行Spring GWT集成的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。