Class GuiceRestApplication

java.lang.Object
javax.ws.rs.core.Application
com.peterphi.std.guice.web.rest.jaxrs.GuiceRestApplication
All Implemented Interfaces:
GuiceApplication

public class GuiceRestApplication extends javax.ws.rs.core.Application implements GuiceApplication
A jax-rs REST Application implementation that returns singletons whih are dynamic proxies bound to objects built by Guice
This allows for a vanilla jax rs implementation, albeit at a small runtime performance penalty.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    If constructing from within a guice environment we should use the existing GuiceRegistry
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when a new Injector has been created, after Guice injection has been applied to this instance.
     
    void
    Called when an Injector is stopping and before the ShutdownManager for the GuiceRegistry is signalled
    The GuiceRegistry will wait for this method to return before proceeding.

    Methods inherited from class javax.ws.rs.core.Application

    getClasses, getProperties

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GuiceRestApplication

      public GuiceRestApplication()
    • GuiceRestApplication

      @Inject public GuiceRestApplication(GuiceRegistry guiceRegistry)
      If constructing from within a guice environment we should use the existing GuiceRegistry
      Parameters:
      guiceRegistry -
  • Method Details

    • getSingletons

      public Set<Object> getSingletons()
      Overrides:
      getSingletons in class javax.ws.rs.core.Application
    • configured

      public void configured()
      Description copied from interface: GuiceApplication
      Called when a new Injector has been created, after Guice injection has been applied to this instance.

      No guarantees are made about the order in which GuiceApplication instances will be called

      Specified by:
      configured in interface GuiceApplication
    • stopping

      public void stopping()
      Description copied from interface: GuiceApplication
      Called when an Injector is stopping and before the ShutdownManager for the GuiceRegistry is signalled
      The GuiceRegistry will wait for this method to return before proceeding. No guarantees are made about the order in which GuiceApplication instances will be called
      Specified by:
      stopping in interface GuiceApplication