org.restlet.engine.component

## Class ChildContext

- java.lang.Object
- - org.restlet.Context
  - - org.restlet.engine.component.ChildContext

    public class ChildContext
    extends Context

Context based on a parent component's context but dedicated to a child Restlet, typically to an application.

Author:
  Jerome Louvel

### Constructor Summary

Constructors
Constructor and Description
`ChildContext(Context parentContext)` Constructor.

### Method Summary

Methods
`Context` `createChildContext()` Creates a protected child context.
`static void` `fireContextChanged(Restlet restlet, Context context)` Indicates that a Restlet's context has changed.
`static java.lang.String` `getBestClassName(java.lang.Class<?> clazz)` Return the best class name.
`Restlet` `getChild()` Returns the child.
`static java.lang.String` `getLoggerName(java.lang.String baseName, java.lang.Object owner)` Returns a non-null logger name.
`protected Context` `getParentContext()` Returns the parent context.
`void` `setChild(Restlet child)` Sets the child.

### Methods inherited from class org.restlet.Context

`getAttributes, getClientDispatcher, getCurrent, getCurrentLogger, getDefaultEnroler, getDefaultVerifier, getLogger, getParameters, getServerDispatcher, setAttributes, setClientDispatcher, setCurrent, setDefaultEnroler, setDefaultVerifier, setLogger, setLogger, setParameters, setServerDispatcher`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ChildContext

    public ChildContext(Context parentContext)

Constructor.

Parameters:
  `parentContext` - The parent context.

### Method Detail

#### fireContextChanged

    public static void fireContextChanged(Restlet restlet,
                          Context context)

Indicates that a Restlet's context has changed.

Parameters:
  `restlet` - The Restlet with a changed context.
  `context` - The new context.

#### getBestClassName

    public static java.lang.String getBestClassName(java.lang.Class<?> clazz)

Return the best class name. If the class is anonymous, then it returns the super class name.

Parameters:
  `clazz` - The class to name.
Returns:
  The class name.

#### getLoggerName

    public static java.lang.String getLoggerName(java.lang.String baseName,
                                 java.lang.Object owner)

Returns a non-null logger name. It is composed by the canonical class name of the owner object suffixed by the owner's hash code.

Parameters:
  `baseName` - The base logger name to prepend, without a trailing dot.
  `owner` - The context owner.
Returns:
  The logger name.

#### createChildContext

    public Context createChildContext()

Description copied from class: `Context`
Creates a protected child context. This is especially useful for new application attached to their parent component, to ensure their isolation from the other applications. By default it just creates a new context instance.

Overrides:
  `createChildContext` in class `Context`
Returns:
  The child context.

#### getChild

    public Restlet getChild()

Returns the child.

Returns:
  the child.

#### getParentContext

    protected Context getParentContext()

Returns the parent context.

Returns:
  The parent context.

#### setChild

    public void setChild(Restlet child)

Sets the child.

Parameters:
  `child` - The child.