I have a question related to the GWT deployment of client side and server side. I am wondering, are they deployed in the same computer? Or they can be deployed to different computers?
我有一个与客户端和服务器端的GWT部署有关的问题。我想知道,他们是否部署在同一台计算机上?或者他们可以部署到不同的计算机?
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.
例如,在客户端,我需要上传文件。我可以将此文件的URL传递给GWT服务器端,并读取服务器端的数据吗?目前,我正在使用FileUpload Widget,但这会将文件的输入流传递到服务器端。
Thanks in advance!
提前致谢!
2 个解决方案
#1
2
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.
通常,GWT应用程序的客户端部分(编译为JavaScript)和服务器部分(例如,由客户端部分调用的Servlet)部署到同一HTTP服务器。作为一个简单的例子,这可以是Tomcat或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.
当用户将其浏览器定向到您的GWT应用程序时,客户端部分(JavaScripts)通过主页加载,并且您的GWT应用程序在用户的浏览器中运行。
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".
因此,如果您希望用户能够上传文件,则必须使用FileUpload小部件。它与带有“file”类型的输入字段的简单HTML表单相同。
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.
在服务器端,您必须单独处理文件上载。如果您在服务器端使用Java,我建议使用Apache FileUpload库。项目主页上有一个出色的用户指南。
#2
2
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.
您的GWT客户端 - 静态HTML,JS,CSS和图像 - 可以部署到任何HTTP服务器。如果使用Java后端,则需要将其部署在Java应用服务器上,例如Jetty。这些可以是相同的服务器软件或不同的软件,相同的硬件或不同的硬件。
Your question about file uploads is really orthogonal to your deployment strategy.
您关于文件上传的问题与您的部署策略完全正交。
#1
2
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.
通常,GWT应用程序的客户端部分(编译为JavaScript)和服务器部分(例如,由客户端部分调用的Servlet)部署到同一HTTP服务器。作为一个简单的例子,这可以是Tomcat或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.
当用户将其浏览器定向到您的GWT应用程序时,客户端部分(JavaScripts)通过主页加载,并且您的GWT应用程序在用户的浏览器中运行。
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".
因此,如果您希望用户能够上传文件,则必须使用FileUpload小部件。它与带有“file”类型的输入字段的简单HTML表单相同。
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.
在服务器端,您必须单独处理文件上载。如果您在服务器端使用Java,我建议使用Apache FileUpload库。项目主页上有一个出色的用户指南。
#2
2
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.
您的GWT客户端 - 静态HTML,JS,CSS和图像 - 可以部署到任何HTTP服务器。如果使用Java后端,则需要将其部署在Java应用服务器上,例如Jetty。这些可以是相同的服务器软件或不同的软件,相同的硬件或不同的硬件。
Your question about file uploads is really orthogonal to your deployment strategy.
您关于文件上传的问题与您的部署策略完全正交。