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

泪湿孤枕 提交于 2019-12-13 03:38:34

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/3272158/how-to-respond-if-possible-to-http-get-requests-in-gwt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!