我可以将这两个Web应用程序合并为一个使用GWT Servlet和RESTful API的应用程序吗? [英] Can I merge these two web applications to become one using GWT Servlet and RESTful API?

查看:88
本文介绍了我可以将这两个Web应用程序合并为一个使用GWT Servlet和RESTful API的应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始编写两个Web应用程序项目使用Spring REST API的移动客户端的RESFful API

$ b



  • 使用Servlet的Web客户端的GWT WebApp服务器


我的问题是两个Web应用程序都使用相同的数据库,我认为我不应该使用两个 web应用程序,而是应该使用一个处理Web和移动客户端请求的web应用程序启动该项目。



现在我得到的问题是我不知道如何才能合并这两个人,以及是否应该坚持使用Spring REST API,或者如果我应该使用RestyGWT。 使用Servlet的GWT服务器项目

$ b



使用Spring的RESTful Server



所有项目(在重大任务中)





有没有一种方法可以让我作为一个整体启动web应用程序并且可以从我的移动客户端访问REST API并从我的Web客户端访问Servlet? 解决方案

这取决于您的业务逻辑实施。如果您将它放在单独的模块/包中,那么合并您的两个应用程序应该很容易。

您将不得不重写web.xml中的映射,以及如何将输入/输出数据从REST实现和servlet代码传递到业务逻辑方法。



就个人而言,我会推荐一种方法,例如只使用您已有的基于REST的方法,然后将您的servlet功能迁移到它。


I have started to write two web application projects

  • RESFful API for mobile clients using Spring REST API
  • GWT WebApp Server for web clients using Servlets

My problem is that both web applications are using the same database and that I think that instead of having two web applications I actually should have started this project using just one web application that handles the requests for web and mobile clients.

The problem I got now is that I don't have any idea how I could "merge" those two guys and whether I should stick to Spring REST API or if I should use RestyGWT.

GWT Server-Project using Servlets

RESTful Server using Spring

All projects (in the middle of a major refactoring mission)

Is there a way that would allow me to launch the web application as a whole and have access to the REST API from my mobile clients and to the Servlets from my web clients?

解决方案

It depends on your business logic implementation. If you have it in a separate module/package, then it should be easy to merge your two applications.

You will have to rework the mappings in web.xml and how you pass the input/output data to the business logic methods from both the REST implementation and your servlet code.

Personally I will recommend a single approach such as only going with the REST based approach that you already have and migrate your servlet functionality to it.

这篇关于我可以将这两个Web应用程序合并为一个使用GWT Servlet和RESTful API的应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆