title: Context of RESTlet Application is null using internal RESTlet Server
body: <p>I have a Restlet (2.0.10) application, I start with the following code:</p>
  
  <pre><code>public static void main(final String[] args) {
      try {
          // Create a new Component
          final Component component = new Component();
  
          // Add a new HTTP server listening on port 8182
          component.getServers().add(Protocol.HTTP, SERVER_PORT);
  
          // Add a client protocol connector for static files
          component.getClients().add(Protocol.FILE);
  
          // Attach the sample application.
          component.getDefaultHost().attach("/myApp", new MyApplication(Context.getCurrent()));
  
          // Start the component.
          component.start();
  
      } catch (Exception e) {
          LOGGER.error(e);
      }
  
  }
  </code></pre>
  
  <p>Now I require the applications root (i.e. /myApp) inside the application and I try to get this according to <a href="https://stackoverflow.com/questions/3893386/java-accessing-servletcontext-from-within-restlet-resource">Java accessing ServletContext from within restlet Resource</a>:</p>
  
  <pre><code>Client serverDispatcher = context.getServerDispatcher();
  ServletContext servletContext = (ServletContext)serverDispatcher.getContext().getAttributes()
                      .get("org.restlet.ext.servlet.ServletContext");
  String contextPath = servletContext.getContextPath();
  </code></pre>
  
  <p>This works perfectly fine while deploying my application to a Tomcat Server, but as soon as I start the server using a Component as shown above, my Context is always null. Can someone please tell me how to get a properly initialized context using restlets internal server capabilities?</p>