javajettygeoserverwfs

How can I run GeoServer without the web frontend?


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

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 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?


Solution

  • 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.