xtext-services and iframe [message #1840947] |
Thu, 29 April 2021 11:39  |
z232 I Messages: 48 Registered: February 2016 |
Member |
|
|
Hi,
I have created a web application with a simple "hello world" DSL.
I run the project with gradle in localhost 8080.
When accessing the web app from any browser (firefox, chrome etc ) everything seems to work fine. The validation of the DSL, in case of syntactic errors, shows respectively the errors in each line of the text editor.
The thing is that, in case i embed inside another web page ( through an iframe) the "localhost:8080" , the validation errors and generally the xtext services, don't work.
In the console.log of each browser i use, i am getting the following error
GET http://localhost:8080/xtext-service/occurrences?resource=21769cf1.ddl&caretOffset=203&requiredStateId=-80000000 404 (Not Found) jquery.min.js:2
a snapshot of my index.html is presented below
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="en-us">
<title>Example Web Editor</title>
<link rel="stylesheet" type="text/css" href="xtext/2.20.0/xtext-ace.css"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="webjars/requirejs/2.3.6/require.min.js"></script>
<script type="text/javascript">
var baseUrl = window.location.pathname;
var fileIndex = baseUrl.indexOf("index.html");
if (fileIndex > 0)
baseUrl = baseUrl.slice(0, fileIndex);
require.config({
baseUrl: baseUrl,
paths: {
"jquery": "webjars/jquery/3.4.1/jquery.min",
"ace/ext/language_tools": "webjars/ace/1.3.3/src/ext-language_tools",
"xtext/xtext-ace": "xtext/2.20.0/xtext-ace"
}
});
require(["webjars/ace/1.3.3/src/ace"], function() {
require(["xtext/xtext-ace"], function(xtext) {
xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/mode-mydsl"
});
});
});
</script>
</head>
<body>
<div class="container">
<div class="header">
<h1>Example MyDsl Web Editor</h1>
</div>
<div class="content">
<div id="xtext-editor" data-editor-xtext-lang="mydsl"></div>
</div>
</div>
</body>
</html>
thanks in advance
[Updated on: Thu, 20 May 2021 14:54] Report message to a moderator
|
|
|
|
|
|
|
|
Re: xtext-services and iframe [message #1840961 is a reply to message #1840956] |
Thu, 29 April 2021 13:44   |
z232 I Messages: 48 Registered: February 2016 |
Member |
|
|
Christian,
Unfortunately i run this server locally, so i cannot provide you a link to see the behavior of the system as a hole. I will try to explain the steps i followed, to create the DSL web application and the index.html with the iframe pointing on the server.
First step was to create a xtext project,
generated the artifacts of that dsl language
and run it with gradle on port 8080.
I opened a browser to see if the web app dsl is working as expected.
Everything seems to work as expected regarding the xtext-services.
The second step was to create a index.html file (like the one that i mentioned in my previous post). This file has an iframe inside with src="http://localhost:8080".
In this case when i open the file with a browser, the localhost :8080 shows up inside the iframe, but the xtext-services are crashing.
Sorry, i try to be more detailed about the problem.
I hope its more understundable.
thanks
[Updated on: Thu, 20 May 2021 14:55] Report message to a moderator
|
|
|
|
|
|
|
Re: xtext-services and iframe [message #1840969 is a reply to message #1840965] |
Thu, 29 April 2021 14:56   |
z232 I Messages: 48 Registered: February 2016 |
Member |
|
|
That's pretty weird!
I guess that inside your web root folder there are two index files
a) index.html , that is created from the wizard while generating the artifacts
b) index_.html , that you created and contains the iframe, which points to the link "http://localhost.8080"
Maybe there is no confilict when both index files are inside the project. Have you try to move the index_html file outside the scope of the project?
Or maybe there might be some configuration problem or some issue with the version of xtext.
thanks
[Updated on: Thu, 20 May 2021 14:55] Report message to a moderator
|
|
|
|
|
|
|
Re: xtext-services and iframe [message #1840986 is a reply to message #1840982] |
Thu, 29 April 2021 20:39   |
z232 I Messages: 48 Registered: February 2016 |
Member |
|
|
No it keeps the same resourceID which is the default start -80000000
Thats because it can't do the update and decrease by 1.
The strange thing is that the validator works in Firefox.
In the other Browsers (Opera, Chrome and Edge) i get the errors i mentioned in my previous posts.
Have you tested only with Firefox ?
Did you tested also with the rest of the Browsers?
Bests
[Updated on: Thu, 20 May 2021 14:56] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03102 seconds