Intellij RestService in MPS

I have a plugin in Intellij that uses an Oauth2 flow that makes use of the RestService class in org.jetbrains.ide to handle the callback. It looks like i can make use of the RestService class in MPS. I am looking to call back http://127.0.0.1:63342/api/<myService> or http://127.0.0.1:63342/api/<myService> like i did in my Intellij plugin. Looks like when i take this approach i keep getting 404s "JetBrains MPS 2017.3.5". Am i doing something wrong?

1
1 comment

Can you please clarify do you get on 404 on request only to your service you get to any other services? For instance, you can check http://127.0.0.1:63342/api/about, that should return the name and version of the running MPS application. Note that if you're running several applications based on IDEA platfrom, they will be accessible from different ports starting from 63342. For example, if you open IDEA and then MPS applications, the first one will be listening to 63342, and the second - 63343.

Another problem that you might encounter, is that you haven't registred your service. To do so you need to wrap your service in idea plugin and specify your service in a plugin.xml file:

<idea-plugin> 
  ...
  <extensions defaultExtensionNs="com.intellij">
    <httpRequestHandler implementation="YourRestServiceClassFQName" />
  </extensions>
</idea-plugin>

By the way, have you tried to implement your service with HTTP Support Plugin in MPS? You can find documentation how to do it here.

1

Please sign in to leave a comment.