Example #1
0
  /**
   * Constructor with the Restlet's context which can be the parent's application context, but
   * shouldn't be the parent Component's context for security reasons.
   *
   * @see Context#createChildContext()
   * @param context The context of the Restlet.
   */
  public Restlet(Context context) {
    this.context = context;
    this.started = false;
    this.name = toString();
    this.description = null;
    this.author = null;
    this.owner = null;

    if (Engine.getInstance() == null) {
      Context.getCurrentLogger()
          .severe("Unable to fully initialize the Restlet. No Restlet engine available.");
      throw new RuntimeException(
          "Unable to fully initialize the Restlet. No Restlet engine available.");
    }

    org.restlet.engine.component.ChildContext.fireContextChanged(this, context);
  }
Example #2
0
 /**
  * Sets the context.
  *
  * @param context The context.
  */
 public void setContext(Context context) {
   this.context = context;
   org.restlet.engine.component.ChildContext.fireContextChanged(this, context);
 }