logzio / guice-jersey

Guice module for starting Jetty based rest server with Jersey
Apache License 2.0
40 stars 11 forks source link

support adding servlets #1

Closed nasis closed 7 years ago

nasis commented 7 years ago

Talked to Mesika and this addition was accepted with positive nod :-) Let's move forward

asafm commented 7 years ago

I read carefully the the Guice-Jersey code @asafalima wrote, and started thinking what is the best way of adding servlets through it without losing its functionality. I have some suggestions on doing that, and some things we should improve. Better discuss this via online whiteboard session.

  1. This module should be called Guice-Jetty, as essentially it is designed to allow composing a Jetty server, configuring it, and binding it to the application life-cycle (start/stop). this module
  2. This module should offer both features of Jetty:
    1. Easy way of registering Servlets and Filters
    2. Easy way of registering JAX-RS Resources.
  3. The module will offer registering Servlets and Filters through the existing Guice ServletModule class which offers a good DSL for doing that via sub-classing ServletModule. As the documentation states, you can simply add another module, which extends ServletModule, add servlets to it via its DSL, and it will be picked up (through the GuiceFilter).
  4. The module will offer registering JAX-RS Resource simply by using the JAX-RS Resource annotation.
  5. The configuration options should be:
    1. Jetty
      1. Server Connectors
      2. Additional Jetty configurations ? (Thread pools, etc) ?
    2. Jersey
      1. Context path
      2. ResourceConfig

Another though as crossed my mind, throwing it out in the open to brain storm it: ServletModule managed to allow you to register Servlet and Filter via Guice without being tightly coupled to an specific server implementation. Can we do the same with JAX-RS?

nasis commented 7 years ago

Will not be merged. Was implemented in gaia-full as ServletModule.