title: How to get HK2 ServiceLocator in a Jersey2 ServletContainer?
body: <p>I'd like to get Jersey2 and Guice to cooperate together, which is apparently rather difficult. I've seen some solution to this involving using the HK2-to-Guice bridge. But the bridge rely on getting the HK2 <code>ServiceLocator</code> instance in the <code>init()</code> of a custom Jersey2 <code>ServletContainer</code> in order to initialize <code>GuiceBrige</code>:</p>
  
  <pre><code>public class MyServletContainer extends ServletContainer {
    @Override public void init() {
      ServiceLocator sloc = getApplicationHandler().getServiceLocator();
      ...
  } }
  </code></pre>
  
  <p>But somehow in the latests version of Jersey (2.26), the <code>getServiceLocator()</code> does not longer exists in <code>ApplicationHandler</code>. How can I get it in this context?</p>