Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext web services validate (Check for valid dsl on Server)
Xtext web services validate [message #1752992] Tue, 31 January 2017 18:50 Go to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
I have my grammar working with the Xtext web editors but what I am looking to do is to send a custom command back to the web editor when I know that dsl entered into the editor is valid and complete. I am trying to find some examples on extending the Xtext servlets.
Re: Xtext web services validate [message #1753006 is a reply to message #1752992] Wed, 01 February 2017 04:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i dont get that. why not simply call the validation service (/validate) that is already there and is already called by default by the editors?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753046 is a reply to message #1753006] Wed, 01 February 2017 12:29 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
Christian thanks for the reply! I may have not been clear. I am using the validate service (/validate) that is already there from the client, however on the server I need to know when the the dsl entered in the editor is valid so I that I can update other parts of my web application and do some additional processing of the data. I am trying to understand where to properly plugin my code into the server(servlets) workflow.

Re: Xtext web services validate [message #1753048 is a reply to message #1753046] Wed, 01 February 2017 12:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
can you be a bit more specific on what action should trigger that validation?
do you simply want to add another service?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753049 is a reply to message #1753048] Wed, 01 February 2017 12:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
If you simply want a custom service,

subclass XtextServiceDispatcher and bind in YourDslWebModule

def Class<? extends XtextServiceDispatcher> bindXtextServiceDispatcher() {
return YourServiceDispatcher
}

should work


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753056 is a reply to message #1753048] Wed, 01 February 2017 13:25 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
The validation service is called as the user types the dsl into editor and when the validation service has validated the dsl and no errors are being returned by the validation service I want to be able to execute some additional code on the server. I am new to using the web editors and xtext. Would the best approach be to create a custom service or is there a way to run additional code on the server when the validation service has validated the dsl and no errors are being generated.
Re: Xtext web services validate [message #1753057 is a reply to message #1753056] Wed, 01 February 2017 13:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
can you please be more specific about the kind of things you want to do

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753059 is a reply to message #1753057] Wed, 01 February 2017 13:32 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
Once the dsl has been validated correctly I need to send a Web Socket message to the Web app with instructions to update some visuals that represents the dsl.
Re: Xtext web services validate [message #1753066 is a reply to message #1753059] Wed, 01 February 2017 14:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes but why no doing this simply on client side?
the validation service already sends this info back to the client
so you simply need to hook in.
which framework (ace/codemirror/orion) do you use?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753104 is a reply to message #1753066] Wed, 01 February 2017 20:47 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
One reason is that when the dsl is validated I not just sending back the text they have typed in but sending back the AST along with specific commands that will generate on the server.
Re: Xtext web services validate [message #1753107 is a reply to message #1753104] Wed, 01 February 2017 20:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
which server are you talking to

in xtext web support you have the client (in the browser, javascript + editor framework)
that talks to the xtext services in the backend

these services support stuff like

- content assist
- sending text updates (what the user typed)
- ask for validation
- ask for generation + the results.

=> everything happens in the backend (parsing, ast, validation, generation)

so i dont get what you want to send from where to where.

what is your "back" the client? the server?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753113 is a reply to message #1753107] Wed, 01 February 2017 22:43 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
I have a web app that is using the codemirror editor along with other components of my app. The user can use the codemirror editor to type in the dsl text which makes calls to the xtext services for update, validation. parsing and generating the ast. Once the user has type in the text and validation service has validated and the ast is generated. I want to be able to send a message from the xtext backend via a servlet to the web app not the editor with the ast and app specific information to display to the user.

I hope this make more sense. I was hoping that I would be able to know when the dsl has been validated for the backed java server(Jetty)



[Updated on: Wed, 01 February 2017 23:00]

Report message to a moderator

Re: Xtext web services validate [message #1753127 is a reply to message #1753113] Thu, 02 February 2017 06:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
So you simply want to customize the validation service in the backend ?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753129 is a reply to message #1753127] Thu, 02 February 2017 06:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
or do you want to have a new service "validate and give me the ast"

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753130 is a reply to message #1753129] Thu, 02 February 2017 06:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
So is web app = another backend or is web app = some other JavaScript in the front end

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753198 is a reply to message #1753130] Thu, 02 February 2017 16:07 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
Yes I would like to customize the validate service or create a new service that validates and give me ast. Which ever would make the most sense. I originally was looking to customize the validate service if that is possible but in either case was not sure where to start and could no find any examples of doing this,

Re: Xtext web services validate [message #1753201 is a reply to message #1753198] Thu, 02 February 2017 16:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i still dont get the internas of your requirements so i cannot tell you what is best.
but you can either bind subclasses of the existing services in your webmodule or extend xtextservicedispatcher and bind it there as well.

what i really dont understand is what do you mean with "give me the ast". what do you indend to do with it?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753202 is a reply to message #1753201] Thu, 02 February 2017 16:31 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
Thanks Christian! That helps me get started. If I understand you correctly I can get a subclass of ValidateService and be able to handle the request from the editor for this service.
Re: Xtext web services validate [message #1753203 is a reply to message #1753202] Thu, 02 February 2017 16:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you wont need to. the editor already calls the validation service

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext web services validate [message #1753204 is a reply to message #1753203] Thu, 02 February 2017 16:42 Go to previous messageGo to next message
Alan Frye is currently offline Alan FryeFriend
Messages: 41
Registered: January 2017
Member
Previously you said that I could bind subclasses of the services or use xtextdispatcher service. Are there any example of doing with of these.

Re: Xtext web services validate [message #1753206 is a reply to message #1753204] Thu, 02 February 2017 16:47 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no but it should work with the normal xtext patter

def Class<? extends BaseClass> bindBaseClass() {
SubClass
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext 2.11 is out
Next Topic:Couldn't resolve reference to ...
Goto Forum:
  


Current Time: Sat Apr 20 03:46:28 GMT 2024

Powered by FUDForum. Page generated in 0.04696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top