Ratpack handlers have access to ratpack internal components. Especially:
- context - implements interface ratpack.handling.Context
- registry - implements interface ratpack.registry.Registry
- publicAddress - implements interface ratpack.server.PublicAddress
context and registry variables are accessible without declaration. The other has to be declared as handler parameter.
In order to get public address of ratpack application declare publicAddress variable in your handler. In ratpack.groovy file import: