4 General Usage - Reference Documentation
Authors: Burt Beckwith
Version: 0.1
4 General Usage
Usage
Start the application with$ grails run-dropwizard
URLs
As a hybrid application, the Grails URLs and Dropwizard URLs use different context paths. For example the Grails controllers might be configured under http://www.servername.com:8080/app/ and the Dropwizard endpoints under http://www.servername.com:8080/dw/. It would be more convenient to have one as a sub-context, e.g. http://www.servername.com:8080/app/ and http://www.servername.com:8080/app/dw/ but given the approach that Dropwizard uses to determine the resource handlers, this isn't possible.The context for your Grails controllers is determined the same way as when not using this plugin, i.e. it defaults to the application name but can be overridden. Specify the Dropwizard context with thegrails.plugin.dropwizard.dropwizardContext
attribute in Config.groovy
- it defaults to "dropwizard".Admin URIs
Dropwizard has an admin servlet with some convenient URIs to monitor your application. By default this port is 8081, and the URIs include:- http://server:8081/dropwizard/metrics
- displays extensive runtime and usage information; append ?pretty=true to pretty-print the JSON output
- http://server:8081/dropwizard/healthcheck
- runs all health checks and displays their statuses
- http://server:8081/dropwizard/threads
- displays a thread dump
- http://server:8081/dropwizard/ping
- responds with "pong" as a simple test that something is there
Utility methods
Dropwizard displays all known endpoints at startup, but this information is also available at runtime. Dependency-inject thedropwizardService
bean and calldef dropwizardService...def endpoints = dropwizardService.findEndpoints()
List
of grails.plugin.dropwizard.util.EndpointData
You can also retrieve information from Dropwizard via the dropwizard
Spring bean. This is simply a holder class, and has fields configuration
(the com.yammer.dropwizard.config.Configuration
), environment
(the com.yammer.dropwizard.config.Environment
), and service
(the grails.plugin.dropwizard.GrailsService
)