HTML preview: local file or internal web server?

I am confused by the outcome of starting a HTML preview by clicking on the browser icon.

Sometimes the file is loaded directly into the Browser ("file:///..."), sometimes the build-in web server is used ( via http://localhost:63342/...)

I am workig with a project where both happens (in one module files, in the other web server) and i have no clue how to configure IntelliJ to always use the web server.
Same behaviour when using Live Edit.


IDE Version: 13.1.3 Ultimate

5 comments
Comment actions Permalink

It is strange. Do you have configured deployment server (Remote Hosts Access)?

>> Sometimes the file is loaded
The same file? During the same IDEA session or after project reopen/application restart?

>> i have no clue how to configure IntelliJ to always use the web server.
As workaround you can enable plugin "Remote Hosts Access" and configure in-place web server.

0
Comment actions Permalink

>> The same file? During the same IDEA session or after project reopen/application restart?
No, each single is treated constantly in its own way.
I have a Project with multiple Modules. In two of them all HTML files are opend via file://, in one module all are opened via htttp.

What is the expected way a file should normaly be loaded? When the mouse hovers over the browser icon, a tool tip always say "... hold Shift to open URL of local file", which lets me expect that without Shift it should be opened via http.

>> As workaround you can enable plugin "Remote Hosts Access" and configure in-place web server.
The "Remote Hosts Access" plugin was enabled, but not configured. I disabled it without any effect.
My guess is, that the "Live Edit" plugin (installed and activated) may have some influence on the way the files are opened.

0
Comment actions Permalink

>> My guess is, that the "Live Edit" plugin (installed and activated) may have some influence on the way the files are opened.
No, — Ruby, Python (Django), JSP, PHP could influence. Please check — do you have any of these plugins installed.

>> No, each single is treated constantly in its own way.
Good, so, it is easy to fix bug.

Could you please send me test project, so I can try to reproduce?

0
Comment actions Permalink

Here is a sample project.

Open ...\src\main\webapp\WEB-INF\templates\extrathyme.html and start a browser preview.

The file gets loaded via "file:///...."



Attachment(s):
extrathyme.zip
0
Comment actions Permalink

Thanks for test project. Reproduced.

extrathyme.html is template in your JavaEE application. JavaEE web browser url provider in action instead of default built-in web server url provider.

There are two scenarios:
1) Java EE server is not running (tomcat in your case) — In this case regardless of configuration any file that have associated Web Facet will be opened via file:// url.
2) Java EE server is running — JavaEE web browser url provider tries to compute URL for file, and, if failed, file:// url. will be used.

In your case extrathyme.html is template, and we need to analyze ExtraThymeController.show implementation to compute correct URL. It is not implemented, if you sure, that it could be and should be done — please file issue.


What I can do — it is not clear for me, do you understand that extrathyme.html could not be correctly opened via built-in web server (because it is not java ee server, it just serves static resources)?

0

Please sign in to leave a comment.