如何编写Android客户端服务器应用程序? [英] How to write android client server application?

查看:185
本文介绍了如何编写Android客户端服务器应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个Android应用程序,它与一些服务器中的应用程序将查询到的服务器和服务器将与几个对象答复工作。

I want to write an android application which works with some server in which app will query to server and server will reply with few objects.

我已经测试登录功能使用下面的方法的Java servlet。

I have tested login functionality with Java servlet using following method.

http://myhost:8080/androidapp/login?username='myusername'&password='mypassword'

但似乎这不是做这种交易的安全途径。任何方式的用户将无法看到此信息,但我仍想知道是否安全使用此方法。

But it seems that this is not the secure way to do such transactions. Any way user will not be able to see this information but still I want to know that is it secure to use this method.

在项目将增加服务器将发送多个对象和Android应用也将需要发送的参数太多,所以我觉得上面的方法是没有用的。

When project will grow server will send many objects and android app also will need to send too many parameters so I think above method is useless.

请建议我一些方法,通过它我可以让我的工作轻松完成没有进入其他技术如PHP等,因为我已经使用JSF和Android客户端应用程序方面工作,所以这将是我很难学习新的东西很短的时间。

Please suggest me some method through which I can get my work done easily without going into other technology like php etc. because I am already working with JSF and android client app side so it would be difficult for me to learn new things in short time.

其他的选项,我虽然是使用RMI(远程方法调用),但我怎么可以用它在eclipse还是会通过的Apache Tomcat支持?
谢谢

Other option which I though is to use RMI (Remote Method Invocation) but how can I use it in eclipse or will it supported by Apache Tomcat? Thanks

推荐答案

我可以建议使用服务器端REST风格的WebApplication。 Android应用可以很容易地因子评分与您的服务器进行交互,你的服务器(这是一个Tomcat像你说的),可以很容易地通过使用Jersey框架的REST API一个RESTful Web服务器。为新泽西认证过程被描述<一href=\"http://stackoverflow.com/questions/2902427/user-authentication-on-a-jersey-rest-service\">here例如。一种用于构建RESTful Web应用程序的教程可以发现这里与其他有用的教程的一起。

I can recommend using a RESTful WebApplication on server-side. Your Android app can easily be tought to interact with your server, and your server (which is a tomcat as you say) can easily be a RESTful Webserver by using the Jersey framework as REST API. The authentication process for Jersey is described here for example. A tutorial for building a RESTful WebApp can be found here along with other useful tutorials.

但要注意的事实,REST是具有建设之前完全通情达理的一个范例。

But be aware of the fact, that REST is a paradigm that has to be fully understanded before building it.

这篇关于如何编写Android客户端服务器应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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