- 浏览: 464241 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
zjxkeven:
放在自己工程上不报错,已放在服务器上就报错
java获得CPU使用率,系统内存,虚拟机内存等情况 -
wang1990cool:
能运行?我报错啊、
java获得CPU使用率,系统内存,虚拟机内存等情况 -
yue_ch:
yue_ch 写道getTotalPhysicalMemory ...
java获得CPU使用率,系统内存,虚拟机内存等情况 -
yue_ch:
getTotalPhysicalMemorySize()get ...
java获得CPU使用率,系统内存,虚拟机内存等情况 -
kjmmlzq19851226:
private RealSubject realSubject ...
代理模式,静态代理与动态代理
1.3版本前整合gwt spring,用到了第三方类,如cglib扩展类具备gwt servlet的功能,随着1.4版本的发布(发布很久了T_T '),整合有了新的方式,闲话不说,看看整合后的servlet如何调用服务:
java 代码
- /**
- * GWTRemoteServiceServlet act as a dispatch servlet for all GWT services
- *
- * in your web.xml, mapping all request /gwtrpc/ to this servlet
- *
- */
- public class GWTRemoteServiceServlet extends RemoteServiceServlet {
- private WebApplicationContext springContext;
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- springContext = (WebApplicationContext) config
- .getServletContext()
- .getAttribute(
- WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
- if (springContext == null) {
- throw new RuntimeException(
- "Check your web.xml setting, no Spring context configured");
- }
- }
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- try {
- HttpRequestContext context = new HttpRequestContext(req, resp, this
- .getServletConfig());
- HttpRequestContext.ThreadLocalHttpRequestContext.set(context);
- ServletContext servletContext = getServletContext();
- perThreadRequest.set(req);
- perThreadResponse.set(resp);
- String pathInfo = req.getPathInfo();
- if (pathInfo.startsWith("/")) {
- pathInfo = pathInfo.substring(1);
- }
- RemoteService service = (RemoteService) springContext.getBean(pathInfo);
- String requestPayload = readPayloadAsUtf8(req);
- // Let subclasses see the serialized request.
- //
- onBeforeRequestDeserialized(requestPayload);
- // Invoke the core dispatching logic, which returns the serialized
- // result.
- //
- String responsePayload = processCall(service, requestPayload);
- // Let subclasses see the serialized response.
- //
- onAfterResponseSerialized(responsePayload);
- // Write the response.
- //
- writeResponse(req, resp, responsePayload);
- } catch (Throwable e) {
- // Give a subclass a chance to either handle the exception or
- // rethrow it
- //
- doUnexpectedFailure(e);
- } finally {
- HttpRequestContext.ThreadLocalHttpRequestContext.remove();
- }
- }
- /**
- * rewrite processCall
- *
- * @param bean
- * @param payload
- * @return
- * @throws SerializationException
- */
- public String processCall(RemoteService bean, String payload)
- throws SerializationException {
- try {
- RPCRequest rpcRequest = RPC.decodeRequest(payload, bean.getClass(),
- this);
- return RPC.invokeAndEncodeResponse(bean, rpcRequest.getMethod(),
- rpcRequest.getParameters(), rpcRequest
- .getSerializationPolicy());
- } catch (IncompatibleRemoteServiceException ex) {
- getServletContext()
- .log(
- "An IncompatibleRemoteServiceException was thrown while processing this call.",
- ex);
- return RPC.encodeResponseForFailure(null, ex);
- }
- }
- }
xml代码:
- <bean id="bookservice" class="com.service.BookService" />
java 代码
- class BookService implements IBookService{
- }
- interface IBookService extends RemoteService{
- }
ok,该servlet继承RemoteServiceServlet,做了三件事
1.init时获得spring webContext
2.service时解析请求字符,如/service/bookservice,获得bookservice名,对应spring bean id
3.重写processCall方法,通过bookservice,在springContext中获得注册了的bookservice,提供调用
评论
14 楼
jiangmin
2008-11-20
GWT+SPRING真的让人弄的很郁闷啊,LZ是否能指点一下啊,根据你这样做了以后,掉用时出现以下错误 貌似那个GWTRemoteServiceServlet 就没调用到:
[WARN] Resource not found: login; (could a file be missing from the public path or a <servlet> tag misconfigured in module org.fungchoi.WebPMC.gwt.xml ?)
[WARN] Resource not found: login; (could a file be missing from the public path or a <servlet> tag misconfigured in module org.fungchoi.WebPMC.gwt.xml ?)
13 楼
yongyuan.jiang
2008-06-14
gwt前端定义一个异常类
public class ApplicationException extends SerializableException implements
IsSerializable {
后台出错抛出这个异常即可
public class ApplicationException extends SerializableException implements
IsSerializable {
后台出错抛出这个异常即可
12 楼
angeltping
2008-06-04
(gwt+spring)我想用aop拦截来判断session超时,但是我怎样才能能像客户端抛异常了让客户端知道我这个掉方法失败的exception是因为session超时了
11 楼
abo
2008-05-14
博主是javaeye上的gwt第一高人,特别希望博主可以就如何用gwt开发一个伸展性比较好的应用整理出一篇完整的文章,这样大家学习起来也比较方便。
再次谢谢博主。
10 楼
arpenker
2008-05-07
偶的个神啊。能否给个完整一点的DEMO啊。万分感激。
arpenker@gmail.com
arpenker@gmail.com
9 楼
arpenker
2008-05-07
倒。。。搞不懂呢。楼主。真是神啊。。弄个完整点的DEMO来啊。
邮箱:arpenker@gmail.com
thanks.
邮箱:arpenker@gmail.com
thanks.
8 楼
yongyuan.jiang
2008-01-09
哦,是这样子的。
1 perThreadRequest和perThreadResponse是private的,你这里怎么可以引用?
我把父类的方法全部写成protected了
2 HttpRequestContext这个类是哪里的?
这个类是自己写的一个类,用于存放requestde
3 readPayloadAsUtf8这个方法为什么我引用不到?
这个方法也是在父类当中
1 perThreadRequest和perThreadResponse是private的,你这里怎么可以引用?
我把父类的方法全部写成protected了
2 HttpRequestContext这个类是哪里的?
这个类是自己写的一个类,用于存放requestde
3 readPayloadAsUtf8这个方法为什么我引用不到?
这个方法也是在父类当中
7 楼
cloudyofsky
2008-01-02
yongyuan.jiang,对你的代码我有些疑惑,还请多多指教。
1 perThreadRequest和perThreadResponse是private的,你这里怎么可以引用?
2 HttpRequestContext这个类是哪里的?
3 readPayloadAsUtf8这个方法为什么我引用不到?
谢谢!
1 perThreadRequest和perThreadResponse是private的,你这里怎么可以引用?
2 HttpRequestContext这个类是哪里的?
3 readPayloadAsUtf8这个方法为什么我引用不到?
谢谢!
6 楼
yongyuan.jiang
2007-12-03
so good ,唉。我对spring那个ModelAndView 还是不懂
5 楼
gwbasic
2007-11-30
谢谢yongyuan.jiang,支持aop
另一个版本
delegate 用法参照 org.springframework.web.servlet.mvc.multiaction.MultiActionController
另一个版本
delegate 用法参照 org.springframework.web.servlet.mvc.multiaction.MultiActionController
public class GwtRemoteServiceController extends RemoteServiceServlet implements Controller, ServletContextAware { private static final long serialVersionUID = 8175888785480720736L; private Object delegate; private ServletContext servletContext; @Override public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } @Override public ServletContext getServletContext() { return servletContext; } @Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { super.doPost(request, response); return null; } @Override public String processCall(String payload) throws SerializationException { Object delegateToUse = this.delegate; if (delegateToUse == null) { return super.processCall(payload); } else { try { RPCRequest rpcRequest = RPC.decodeRequest(payload, delegateToUse.getClass(), this); return RPC.invokeAndEncodeResponse(delegateToUse, rpcRequest .getMethod(), rpcRequest.getParameters(), rpcRequest .getSerializationPolicy()); } catch (IncompatibleRemoteServiceException ex) { getServletContext() .log( "An IncompatibleRemoteServiceException was thrown while processing this call.", ex); return RPC.encodeResponseForFailure(null, ex); } } } public Object getDelegate() { return delegate; } public void setDelegate(Object delegate) { this.delegate = delegate; } }
4 楼
yongyuan.jiang
2007-11-28
方便快速强大,不要把简单问题复杂化
3 楼
yongyuan.jiang
2007-11-28
支持啊,其实就是gwt调用了一个spring服务,而spring服务是一个gwt服务而已
2 楼
gwbasic
2007-11-27
这样做好像不支持aop
1 楼
yongyuan.jiang
2007-11-26
新架构优势:
1.没有使用第三方包扩展,更快速、更稳定
2.由一个servlet转发请求,服务类为spring注册的类,无需继承RemoteServlet,服务类不是servlet
1.没有使用第三方包扩展,更快速、更稳定
2.由一个servlet转发请求,服务类为spring注册的类,无需继承RemoteServlet,服务类不是servlet
发表评论
-
css split tool
2010-05-06 22:50 0css split tool 从gwt中抽取,希望可以在we ... -
GWT网站上线!hotye.com!
2009-03-31 20:26 4955GWT hotye.com 好易自助终 ... -
google web toolkit Serializable
2009-03-25 00:39 955google web toolkit Serializable ... -
gwt :鼠标离开PopupPanel时触发事件
2008-09-05 00:08 1872此功能是丁鹤泽开发的: /** ... -
GWT Hosted模式运行原理
2008-06-14 17:32 3022hosted模式运行原理,对源 ... -
HTMLTemplatePanel使用
2008-05-28 01:20 1609新增功能 1.直接获得html页面元素,无需实例化对象,如:I ... -
GWT服务端抛出前端异常
2008-03-20 17:38 1555在后台抛出异常,并在前端能够捕获 方法很简单:要抛出的App ... -
Gwt 服务端使用hiberante 问题解决
2008-03-20 17:36 1795Gwt 服务端使用hiberante 问题解决 使用hib ... -
GWT & apache-commons-fileUpload 轻松实现文件上传
2008-01-18 11:44 2298gwt使用apache-commons-fileUpload, ... -
GWT Remote Service
2007-12-27 17:38 1941GWT Remote Service 远程调用服务 1.简介 ... -
GWT 模块间:组件管理 & 事件处理
2007-12-13 18:53 2304原始的gwt开发模式在大型项目或复杂页面中并不适用,这促使了 ... -
GWT HTML Template :模板布局&组件自动装配
2007-12-03 19:58 5567GWT HTML Template 1.简介 gwt进行ht ... -
GWT Object Exporter ,GWT模块间传递对象
2007-10-29 15:15 4943GWT Object Exporter<o:p> ...
相关推荐
GWT与Spring整合,分析的很透彻,有代码过程。
smartGwt、spring、Mybatis整合;一个登录和一个分页查询功能;根据用户获取相应的权限;gwt2.4、内付数据表
gwt+spring+hibernate整合例子,导入myeclipse中(要安gwt插件)即可用,数据库自己去代码中查看。包是精简版的,去掉很多不必要的包
一个简单的maven项目,演示 smartgwt + spring + hibernate 整合框架
GWT整合spring网上资源十分少,版本比较旧,晚点进行更新
这是csdn上其他博主的资源,我把它整合起来
GSH:spring3.1.0M2+Hibernate3.5+GWT2.4+JPA+Annotation+Spring4gwt0.0.1亲手整合,也可以上新浪博客去看 http://blog.sina.com.cn/s/blog_687dfecb0100yrmf.html
上次上传的没有包含数据库表这次补上;smartGwt、spring和Mybatis的整合
GWT+spring的一个实例 需要插件apache 的maven
GWT整合SPRING, 愿与大家分享!
NULL 博文链接:https://hulefei29.iteye.com/blog/746113
基于java的开发源码-Spring4GWT.zip 基于java的开发源码-Spring4GWT.zip 基于java的开发源码-Spring4GWT.zip 基于java的开发源码-Spring4GWT.zip 基于java的开发源码-Spring4GWT.zip 基于java的开发源码-Spring4GWT....
研究gwt+ext+ssh框架整合编写的一个实例,实例中包括一个说明文档(google plugin创建gwt实例说明、gwt-ext实例的创建、gwt-ext与struts2整合实例说明);还包括文档对应的myeclipse项目。相关的包稍微有点大,没有...
一个 gwt 与 spring 集成的例子,本例子通过一个图书查询的功能演示了这两者的集成,希望对你们有帮助.
一个GWT+Spring2+Spring Security2+Hibernate3的实例,数据库为mssql.在/GwtWeb/WebRoot/WEB-INF/lib 目录下RequiredJar.txt有需要用到的库说明 修改一下applicationContext.xml的数据库设定就可以使用
NULL 博文链接:https://digga2012.iteye.com/blog/1450696
gwt与hibernate整合,一个简单的新增和查询,只有一张表(两个字段),大家根据hibernate的配置文件自己生成吧
叉和星演示-gwt-spring 克隆分叉项目 如何从原始回购更新我的回购 git 远程添加上游 git pull 上游主 请注意您是否已经对本地仓库进行了更改!! 如何编译: mvn Eclipse:Eclipse mvn 全新安装 如何导入项目:...
Spring4GWT技术资料