开发者

How to respond (if possible) to http get requests in GWT?

开发者 https://www.devze.com 2023-01-07 13:00 出处:网络
I would like to make a http get request with my Android phone (i know how to do that) and get the file in return (or some other response from database on the server).

I would like to make a http get request with my Android phone (i know how to do that) and get the file in return (or some other response from database on the server). Is it possible to do that in GWT (i just started reading tutorials) on the server side or will i have to learn PHP or sth. 开发者_运维知识库else? I've seen this http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html but don't know if this is what i need.

Thank you very much!


What you need on the Server side is a Servlet engine such as Jetty or Apache Tomcat (or one of many others). You would then write your RPC call as per the link you provided and the server-side Java Servlet (Which is what GWT expects you to provide) would read the file and transfer the data in the file back to the client. The client GWT part of the app would then read the message asynchronously and then do whatever.

For the Server part you need to know Java, I would assume you know that if you are programming GWT.

If you wanted to use something else, like an existing HTTP service in PHP, then you would use the RequestBuilder to build your get or post and send it to the server.

One thing to remember is that everything in your client folder will be compiled to Javascript by GWT. So even though you are working in one project you are actually coding two different systems. One which is in Java (The server folder) and the client piece which GWT translates to Javascript, which runs in the browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号