Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.tiles
Class ComponentContext

    java.lang.Object
      |
      +--org.apache.struts.tiles.ComponentContext

All Implemented Interfaces:
  java.io.Serializable

public class ComponentContext
extends java.lang.Object
implements java.io.Serializable

Component context.

See Also:
  Serialized Form

Field Summary
`private java.util.Map` | `attributes` Component attributes.
`private static java.util.Iterator` | `EMPTY_ITERATOR` EmptyIterator over component attributes.

Constructor Summary
`ComponentContext()` Constructor.
`ComponentContext(ComponentDefinition instance)` Deprecated. Use `ComponentContext(Map attributes)` instead.
`ComponentContext(java.util.Map attributes)` Constructor.

Method Summary
`void` | `addAll(java.util.Map newAttributes)` Add all attributes to this context.
`void` | `addMissing(java.util.Map defaultAttributes)` Add all missing attributes to this context.
`java.lang.Object` | `findAttribute(java.lang.String beanName, javax.servlet.jsp.PageContext pageContext)` Find object in one of the contexts.
`java.lang.Object` | `getAttribute(java.lang.String name)` Get an attribute from context.
`java.lang.Object` | `getAttribute(java.lang.String beanName, int scope, javax.servlet.jsp.PageContext pageContext)` Get object from requested context.
`java.util.Iterator` | `getAttributeNames()` Get names of all attributes.
`static ComponentContext` | `getContext(javax.servlet.ServletRequest request)` Get component context from request.
`void` | `putAttribute(java.lang.String name, java.lang.Object value)` Put a new attribute to context.
`static void` | `setContext(ComponentContext context, javax.servlet.ServletRequest request)` Store component context into request.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### attributes

    private java.util.Map attributes

  Component attributes.

### EMPTY_ITERATOR

    private static java.util.Iterator EMPTY_ITERATOR

  EmptyIterator over component attributes.

Constructor Detail

### ComponentContext

    public ComponentContext()

  Constructor.

### ComponentContext

    public ComponentContext(ComponentDefinition instance)

  Deprecated. Use `ComponentContext(Map attributes)` instead.

  Constructor.

### ComponentContext

    public ComponentContext(java.util.Map attributes)

  Constructor. Create a context and set specified attributes.

Parameters:
  `attributes` - Attributes to initialize context.

Method Detail

### addAll

    public void addAll(java.util.Map newAttributes)

  Add all attributes to this context. Copies all of the mappings from the specified attribute map to this context. New attribute mappings will replace any mappings that this context had for any of the keys currently in the specified attribute map.

  Parameters:
    `newAttributes` - Attributes to add.

### addMissing

    public void addMissing(java.util.Map defaultAttributes)

  Add all missing attributes to this context. Copies all of the mappings from the specified attributes map to this context. New attribute mappings will be added only if they don't already exist in this context.

  Parameters:
    `defaultAttributes` - Attributes to add.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)

  Get an attribute from context.

  Parameters:
    `name` - Name of the attribute.
  Returns:
    <{Object}>

### getAttributeNames

    public java.util.Iterator getAttributeNames()

  Get names of all attributes.

  Returns:
    <{Object}>

### putAttribute

    public void putAttribute(java.lang.String name,
                             java.lang.Object value)

  Put a new attribute to context.

  Parameters:
    `name` - Name of the attribute.
    `value` - Value of the attribute.

### findAttribute

    public java.lang.Object findAttribute(java.lang.String beanName,
                                          javax.servlet.jsp.PageContext pageContext)

  Find object in one of the contexts. Order : component then pageContext.findAttribute()

  Parameters:
    `beanName` - Name of the bean to find.
    `pageContext` - Page context.
  Returns:
    Requested bean or `null` if not found.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String beanName,
                                         int scope,
                                         javax.servlet.jsp.PageContext pageContext)

  Get object from requested context. Context can be 'component'.

  Parameters:
    `beanName` - Name of the bean to find.
    `scope` - Search scope (see `PageContext`).
    `pageContext` - Page context.
  Returns:
    requested bean or `null` if not found.

### getContext

    public static ComponentContext getContext(javax.servlet.ServletRequest request)

  Get component context from request.

  Parameters:
    `request` - ServletRequest.
  Returns:
    ComponentContext

### setContext

    public static void setContext(ComponentContext context,
                                  javax.servlet.ServletRequest request)

  Store component context into request.

  Parameters:
    `context` - ComponentContext to store.
    `request` - Request to store ComponentContext.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 - Apache Software Foundation