GWT codeserver parameter
以下の簡単なシナリオで問題が発生しました。
プロジェクトの構造
myapp
+src
++mypkg
---MainWindow.gwt.xml
---NextWindow.gwt.xml
+++client
----MainWindow.java
----NextWindow.java
+war
--MainWindow.html
--NextWindow.html
MainWindow.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mainwindow'>
<inherits name='com.google.gwt.user.User'/>
<entry-point class='mypkg.client.Mainwindow'/>
<source path='client'/>
</module>
MainWindow.java
package mypkg.client;
import com.google.gwt.core.client.*;
import com.google.gwt.event.dom.client.*;
import com.google.gwt.user.client.ui.*;
public class MainWindow implements EntryPoint {
@Override
public void onModuleLoad() {
Button button = new Button("NextWindow!");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open("/NextWindow.html", null, null);
}
});
RootPanel.get().add(button);
}
}
MainWindow.html
<!doctype html>
<html>
<head>
<title>MainWindow</title>
<script type="text/javascript" language="javascript"
src="mainwindow/mainwindow.nocache.js"></script>
</head>
<body>
<h1>Hi, MainWindow!</h1>
</body>
</html>
NextWindow.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='nextwindow'>
<inherits name='com.google.gwt.user.User'/>
<entry-point class='mypkg.client.NextWindow'/>
<source path='client'/>
</module>
NextWindow.java
package mypkg.client;
import com.google.gwt.core.client.*;
import com.google.gwt.user.client.ui.*;
public class NextWindow implements EntryPoint {
@Override
public void onModuleLoad() {
RootPanel.get().add(new Label("Hi, NewLabel!"));
}
}
NextWindow.html
<!doctype html>
<html>
<head>
<title>NextWindow</title>
<script type="text/javascript" language="javascript"
src="nextwindow/nextwindow.nocache.js"></script>
</head>
<body>
<h1>Hi, NextWindow!</h1>
</body>
</html>
Devmode
リンクからコンパイル済みの myapp を起動すると、
http://127.0.0.1:8888/MainWindow.html?gwt.codesvr=127.0.0.1:9997
「NextWindow」ボタンをクリックGWT browser plugin
すると、苦情ウィンドウが表示されます。
Module NextWindow need be (re)compiled!
確認すると、 のリンクから新しいブラウザ ウィンドウが開きますProdmode
。
http://127.0.0.1:8888/NextWindow.html
の目的のリンクの代わりにDevmode
、
http://127.0.0.1:8888/NextWindow.html?gwt.codesvr=127.0.0.1:9997
したがって、表示のみ、
Hi, NextWindow!
しかし、以下の非常に期待されたコンテンツは表示されません。
Hi, NewLabel!
ソース コードをたどると、との間GWT codeserver parameter
?gwt.codesvr=127.0.0.1:9997
の一貫性を犠牲にすることで問題を解決できます。source level
Devmode
Prodmode
実際に好ましい解決策は何ですか?