开发者

How are GWT client side and server side deployed?

I have a question related to the GWT deployment of client side and开发者_StackOverflow中文版 server side. I am wondering, are they deployed in the same computer? Or they can be deployed to different computers?

For example, on the client side, I need to upload a file. Can I just pass the URL of this file to the GWT server side, and read the data on the server side? For the moment, I am using FileUpload Widget, but this passes the inputstream of the file to the server side.

Thanks in advance!


Usually the client part of a GWT application - which is compiled to JavaScript - and the server part (e.g. Servlets which are called by the client part) are deployed to the same HTTP server. As a simple example this can be a Tomcat or Jetty.

When the user directs his browser to your GWT application, the client side part (the JavaScripts) are loaded via the hostpage and your GWT application is running inside the user's browser.

So if you want your users to be able to upload a file you have to use the FileUpload widget. It's the same as simple HTML form with an input field with type "file".

On the server side you have to deal with fileuploads separately. If you are using Java for the server side, I recommend the Apache FileUpload library. There is an excellent user guide on the project home page.


Your GWT client - static HTML, JS, CSS, and images - can be deployed to any HTTP server. If you use a Java backend, that needs to be deployed on a Java app server, such as Jetty. Those can be the same server software or different software, same hardware or different hardware.

Your question about file uploads is really orthogonal to your deployment strategy.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜