Skip to content

soklet/soklet-tomcat

Repository files navigation

Soklet Tomcat

What Is It?

Tomcat integration for Soklet, a minimalist infrastructure for Java webapps and microservices.

Note: Soklet Tomcat is under active development and will be ready for production use soon.

License

Apache 2.0

Maven Installation

<dependency>
  <groupId>com.soklet</groupId>
  <artifactId>soklet-tomcat</artifactId>
  <version>0.1.0-SNAPSHOT</version>
</dependency>

Direct Download

Coming soon

Example Code

// Assumes you're using Guice as your DI framework via soklet-guice
public static void main(String[] args) throws Exception {
  Injector injector = createInjector(Modules.override(new SokletModule()).with(new AppModule()));
  Server server = injector.getInstance(Server.class);
  
  // Start the server
  new ServerLauncher(server).launch(StoppingStrategy.ON_KEYPRESS, () -> {
    // Some custom on-server-shutdown code here, if needed
  });
}

class AppModule extends AbstractModule {
  @Inject
  @Provides
  @Singleton
  public Server provideServer(InstanceProvider instanceProvider) {
    // We'll have Tomcat be our Soklet server
    return TomcatServer.forInstanceProvider(instanceProvider).port(8080).build();
  }
}

About

Soklet Tomcat was created by Mark Allen and sponsored by Transmogrify, LLC.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages