GWT 修改服务器上的文件
我们都同意,当我们使用 GWT 时,我们在服务器上编译应用程序,创建几个 javascript 文件。通常,我们在部署时会使用混淆模式。
现在,在混淆模式下修改 JavaScript 文件几乎是不可能的。现在,如果我们想对 GWT 应用程序进行一些修改,会发生什么?
难道我们还要再用Java回去,修改文件,编译,然后再次部署吗?
we all agree that when we use GWT, we compile our application on the server, several javascript file are created. Normally, when deploying, we would use the obfuscated mode.
Now modifying a javascript file in obfuscated mode is almost impossible. Now what happens if we want to make some modification in our GWT application.
Do we have to go back again in Java, modify the file, compile, and then deploy again??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想说是的......如果您使用代码生成器,您应该避免手动修改生成的代码。
I'd say yes... If you use a code generator you should avoid modifying the generated code by hand.
不,不,不。
您不必“返回”Java 代码来修改它。您只需调试、测试和修改 Java 代码即可。除了部署之外,您可以忽略已编译的 javascript 文件中的代码。就您而言,GWT 源代码是 Java 代码,而不是 javascript,是在浏览器的环境限制内编写的。
你的问题就像问:“我有一个被编译为目标代码的 C 应用程序。我是修改目标代码还是返回到 C 代码来修改它?” !!!
您只需将生成的 javascript 视为“本机代码”即可。
毫无疑问,您可以使用 jsni 包含 javascript,因此在使用 C 时也可以包含汇编代码。因此,除了您注入的那些汇编代码以及类似的除了您包含的 javascript 代码之外,您无需考虑“本机代码”。
当您尝试修改 C 生成的目标代码时,这称为黑客攻击。黑客是一种有趣的爱好,但是当您希望创建一个应用程序并且您的主要任务不是“黑客”时,黑客只是您的课外活动,与您的主要工作或项目无关。
No, no, no.
You don't "go back" to the Java code to modify it. You simply debug, test and modify the Java code. You ignore the code in the compiled javascript files except to deploy it. As far as you are concerned, GWT source code is Java code, not javascript, written within the environmental restriction of the browser.
Your question is like asking, "I have a C application that gets compiled to object code. Do I modify the object code or go back to the C code to modify it?" !!!
You simply treat the generated javascript as "native code".
No doubt you can include javascript using jsni, and so can you include assembly code when using C. So except for those assembly code you inject and similarly except the javascript code you include, you leave the "native code" alone.
When you try to modify the object code generated from C, that is called hacking. Hacking is an interesting hobby but when you wish to create an application and your main task is not "hacking", hacking would only be your extra-curricular activity not connected to your main employment or project.
返回开头:http://code.google.com/webtoolkit/overview.html< /a>
调试时:如果您在开发模式下运行,您甚至可能不必在开发时重新部署。
Go back to the beginning: http://code.google.com/webtoolkit/overview.html
While debugging: if you are running in development mode you may not even have to redeploy while in dev.