Description from Jarda's email:
I have a version of Twitter Client demo that runs without Grizzly on the
desktop (using JavaFX WebView). However the same application shows just an
empty pane on iOS.
The reason is my usage of jar:file:.... URL scheme. As the iOS WebUI is a
native component, it does not understand custom Java URLs and fails to load
the page. When I replaced the use of jar: URL with load of direct content:
@Override
- public void displayPage(final URL resource, Runnable onLoad) {
+ public void displayPage(URL resource, Runnable onLoad) {
+ final StringBuilder sb = new StringBuilder();
+ try {
+ BufferedReader is = new BufferedReader(new
InputStreamReader(resource.openStream()));
+ for (;;) {
+ String line = is.readLine();
+ if (line == null) {
+ break;
+ }
+ sb.append(line).append('\n');
+ }
+ is.close();
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
engine = FXBrwsr.findEngine(onLoad);
Platform.runLater(new Runnable() {
@Override
public void run() {
- engine.load(resource.toExternalForm());
+ engine.loadContent(sb.toString());
}
});
the page loads, but it does not read relative resources (like CSS).
I think it is desirable to have consistent behavior between desktop and iOS
WebView
I have a version of Twitter Client demo that runs without Grizzly on the
desktop (using JavaFX WebView). However the same application shows just an
empty pane on iOS.
The reason is my usage of jar:file:.... URL scheme. As the iOS WebUI is a
native component, it does not understand custom Java URLs and fails to load
the page. When I replaced the use of jar: URL with load of direct content:
@Override
- public void displayPage(final URL resource, Runnable onLoad) {
+ public void displayPage(URL resource, Runnable onLoad) {
+ final StringBuilder sb = new StringBuilder();
+ try {
+ BufferedReader is = new BufferedReader(new
InputStreamReader(resource.openStream()));
+ for (;;) {
+ String line = is.readLine();
+ if (line == null) {
+ break;
+ }
+ sb.append(line).append('\n');
+ }
+ is.close();
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
engine = FXBrwsr.findEngine(onLoad);
Platform.runLater(new Runnable() {
@Override
public void run() {
- engine.load(resource.toExternalForm());
+ engine.loadContent(sb.toString());
}
});
the page loads, but it does not read relative resources (like CSS).
I think it is desirable to have consistent behavior between desktop and iOS
WebView
- duplicates
-
JDK-8136466 [regression] [WebView] Load single page application from jar
-
- Resolved
-
- relates to
-
JDK-8136466 [regression] [WebView] Load single page application from jar
-
- Resolved
-