Deploying into a servlet container
This document is for the WireMock 2.x baseline. See the documentation for WireMock 3.x preview here
WireMock can be packaged up as a WAR and deployed into a servlet container, with some caveats: fault injection and browser proxying won’t work, __files won’t be treated as a docroot as with standalone, the server cannot be remotely shutdown, and the container must be configured to explode the WAR on deployment. This has only really been tested in Tomcat 6 and Jetty, so YMMV. Running standalone is definitely the preferred option.
The easiest way to create a WireMock WAR project is to clone the sample app.
Deploying under a sub-path of the context root #
If you want WireMock’s servlet to have a non-root path, the additional init param
mappedUnder must be set with the sub-path web.xml (in addition to configuring the servlet mapping appropriately).
See the custom mapped WAR example for details.