HTTP Server
JabRef has a built-in http server. The source is located in the project jabsrv
.
The resource for a library is implemented at org.jabref.http.server.LibraryResource
.
Start http server
The class starting the server is located in the project jabsrv-cli
and is called org.jabref.http.server.cli.ServerCli
.
Test files to server can be passed as arguments. If no files are passed, the last opened files are served. If that list is also empty, the file src/main/resources/org/jabref/http/server/http-server-demo.bib
is served.
Starting with gradle
./gradlew run :jabsrv:run
The GUI is also started. Just close it.
Gradle output:
> Task :jabsrv:run
2025-05-12 11:52:57 [main] org.glassfish.grizzly.http.server.NetworkListener.start()
INFO: Started listener bound to [localhost:6050]
2025-05-12 11:52:57 [main] org.glassfish.grizzly.http.server.HttpServer.start()
INFO: [HttpServer] Started.
JabSrv started.
Stop JabSrv using Ctrl+C
<============-> 96% EXECUTING [43s]
> :jabsrv:run
IntelliJ output, if org.jabref.http.server.ServerCli#main
is executed:
DEBUG: Starting server...
2023-04-22 11:44:59 [ForkJoinPool.commonPool-worker-1] org.glassfish.grizzly.http.server.NetworkListener.start()
INFO: Started listener bound to [localhost:6051]
2023-04-22 11:44:59 [ForkJoinPool.commonPool-worker-1] org.glassfish.grizzly.http.server.HttpServer.start()
INFO: [HttpServer] Started.
2023-04-22 11:44:59 [ForkJoinPool.commonPool-worker-1] org.jabref.http.server.ServerCli.lambda$startServer$4()
DEBUG: Server started.
Developing with IntelliJ
IntelliJ Ultimate offers a Markdown-based http-client. One has to open the file jabsrv/src/test/rest-api.http
. Then, there are play buttons appearing for interacting with the server.
Get SSL Working
When interacting with the Microsoft Word AddIn, a SSL-based connection is required. The Word-AddIn is currentely under development.
(Based on https://stackoverflow.com/a/57511038/873282)
Howto for Windows - other operating systems work similar:
- As admin
choco install mkcert
- As admin:
mkcert -install
cd %APPDATA%\..\local\org.jabref\jabref\ssl
mkcert -pkcs12 jabref.desktop jabref localhost 127.0.0.1 ::1
- Rename the file to
server.p12
Note: If you do not do this, you get following error message:
Could not find server key store C:\Users\USERNAME\AppData\Local\org.jabref\jabref\ssl\server.p12.