SHARE
TWEET

com.example.server.MainServlet

tpeierls Jan 23rd, 2012 178 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * This code is placed in the public domain by its author, Tim Peierls.
  3.  */
  4. package com.example.server;
  5.  
  6. import javax.inject.Inject;
  7. import javax.inject.Provider;
  8. import javax.inject.Singleton;
  9.  
  10. import org.restlet.ext.servlet.ServerServlet;
  11.  
  12.  
  13. /**
  14.  * The adapter that allows a Restlet component to run as a servlet.
  15.  */
  16. @Singleton
  17. public class MainServlet extends ServerServlet {
  18.  
  19.     @Inject MainServlet(Provider<MainComponent> mainComponent) {
  20.         this.mainComponent = mainComponent;
  21.     }
  22.  
  23.     @Override protected MainComponent createComponent() {
  24.         return mainComponent.get();
  25.     }
  26.  
  27.     private final Provider<MainComponent> mainComponent;
  28. }
RAW Paste Data
Top