-
-
Save skurfuerst/94c565cf848a40895dca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def config = { | |
bindings { | |
add new SessionModule() | |
add new MapSessionsModule(10, 5) | |
} | |
handlers { | |
// ... | |
} | |
} | |
// Start up Ratpack | |
def properties = new Properties() | |
properties.setProperty('handlerFactory', 'my.namespace.http.DummyRatpackHandlerFactory') | |
properties.setProperty('port', '5050') | |
properties.setProperty('publicAddress', 'http://' + configurationManager.domainName + ':5050') | |
def baseLaunchConfiguration = LaunchConfigs.createFromGlobalProperties(this.class.classLoader, System.getProperties(), properties) | |
def finalLaunchConfiguration = new DelegatingLaunchConfig(baseLaunchConfiguration) { | |
@Override | |
public HandlerFactory getHandlerFactory() { | |
return new GroovyClosureHandlerFactory(config) | |
} | |
}; | |
ratpackServer = RatpackServerBuilder.build(finalLaunchConfiguration) | |
ratpackServer.start() | |
/** | |
* This is a dummy class which we currently need for instanciating Ratpack and building a proper LaunchConfig. However, in production, | |
* this class is never used. | |
*/ | |
class DummyRatpackHandlerFactory implements HandlerFactory { | |
@Override | |
Handler create(LaunchConfig launchConfig) throws Exception { | |
return null | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment