Home > Blockchain >  How can I run GeoServer without the web frontend?
How can I run GeoServer without the web frontend?

Time:12-06

I am considering switching my applications existing WFS/WMS "SDK" to GeoServer. However my application has a few special requirements.

  • I must remain in control full of the applications entry point (main(...)).
  • I cannot introduce any additional interfaces (such as the GeoServer GUI).

Essentially my application just needs an SDK which exposes our data over an HTTP "/wfs" path. We need to avoid any other interfaces or code being added or exposed. This is unfortunately an unavoidable requirement. Also, until now I have little experience in the GeoServer source code as we have been using a different Toolset. I am of course combing through the source, but am having trouble finding the right classes to get started.

In our existing SDK, I am able to programmatically create a Jetty server with a WFS Servlet assigned to our desired path. One class is provided during the Servlet initialisation which handles communication between our code, and the Servlet.

In order to get a similar setup using GeoServer, I am assuming:

  • I must add org.geoserver.gs-wfs to my pom.xml dependencies
  • I must run my own Jetty server in my Main function, and programmatically add the WFS module somehow

I do not yet know:

  1. How to initialise and add the gs-wfs module to my own programatically created Jetty server
  2. How to get a shared instance of the Catalog to add / remove the configured data

With specific focus on points 1 and 2 above, how do I initialise an instance of "just" the GeoServer WFS endpoint?

CodePudding user response:

The path you're taking is too complicated (besides, there is no WFS servlet to start with)... the GeoServer war is the packaging of a modular application, with a selection of modules of common usage included in it.

If you want to remove the GUI you simply go into the packaged war file, and remove any jar that starts with "gs-web". Since you want full control, you probably want to remove also the administrative REST interface, thus remove also all jars starting with "gs-rest". That should get you close to an application that can start, and can run.

I say "close" because this operation is not commonly attempted, and there might be some unintended cross-module dependency preventing it to work.

Another possibility is to check-out GeoServer, get into src/web/ap (or clone it) and edit the pom.xml file, removing all dependencies you don't want... rebuild and you'll get a minimized war file with only the necessary jars.

CodePudding user response:

GeoServer is a lot more complex than just a pick and mix bag of jars. If you want to create a single jar WFS server you will need to start with a copy of the specification and probably an understanding of how GeoTools (the underlying library of GeoServer) works, and about a year or two of development time.

Or you could read the GeoServer manual and turn off the GeoServer GUI. Then all you need to do is master the REST API to load data into it.

  • Related