How to set up a custom jetbrains://xyz end point in a plugin?

Answered

We'd like to pass some data from a proxy running in a browser to a plugin we develop.

How could we do define in a plugin a custom jetbrains://xyz end point that could be called from a browser?

0
3 comments

Hi,

IntelliJ has the internal HTTP server running and you can create and register your request handlers with com.intellij.httpRequestHandler extension point. The default port is 63342. If the default port is occupied, 63342 + n will be used (n < 20). If still not possible to bind, any free port will be used.

See HttpRequestHandler, RestService, BinaryRequestHandler.

0

That's a helpful answer to a slightly different question - how to implement a web server within a plugin.

My question is how to map a custom jetbrains://xyz end point to an internal web server?
We want to have a fixed url and no potential issues with port collisions.

For example, in VSCode an extension could define vscode://xyz.plugin/etc routes. How to do that in IntelliJ?

0

Hi,

The "jetbrains://" protocol is handled by Toolbox application.

If it is acceptable in your case, there is an extension point: com.intellij.openapi.application.JBProtocolCommand.

Please see example implementations in the platform code and IntelliJ Platform Explorer.

 

0

Please sign in to leave a comment.