org.apache.commons.configuration2.web

## Class ServletContextConfiguration

- java.lang.Object
- - org.apache.commons.configuration2.event.BaseEventSource
  - - org.apache.commons.configuration2.AbstractConfiguration
    - - org.apache.commons.configuration2.web.ServletContextConfiguration

- All Implemented Interfaces:
    Configuration, EventSource, ImmutableConfiguration, SynchronizerSupport

      public class ServletContextConfiguration
      extends AbstractConfiguration

  A configuration wrapper to read the initialization parameters of a servlet context. This configuration is read only, adding or removing a property will throw an UnsupportedOperationException.
  Since:
    1.1
  Version:
    $Id: ServletContextConfiguration.java 1624601 2014-09-12 18:04:36Z oheger $
  Author:
    Emmanuel Bourg

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ServletContext` | `context` Stores the wrapped servlet context.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServletContextConfiguration(Servlet servlet)` Create a ServletContextConfiguration using the context of the specified servlet.
    `ServletContextConfiguration(ServletContext context)` Create a ServletContextConfiguration using the servlet context initialization parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addPropertyDirect(String key, Object obj)` Adds a property to this configuration.
    `protected void` | `clearPropertyDirect(String key)` Removes the property with the given key.
    `protected boolean` | `containsKeyInternal(String key)` Checks whether the specified key is stored in this configuration.
    `protected Iterator<String>` | `getKeysInternal()` Actually creates an iterator for iterating over the keys in this configuration.
    `protected Object` | `getPropertyInternal(String key)` Actually obtains the value of the specified property.
    `protected Object` | `handleDelimiters(Object value)` Takes care of list delimiters in property values.
    `protected boolean` | `isEmptyInternal()` Checks if this configuration is empty.

    - ### Methods inherited from class org.apache.commons.configuration2.AbstractConfiguration

      `addErrorLogListener, addProperty, addPropertyInternal, append, beginRead, beginWrite, clear, clearInternal, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getKeys, getKeysInternal, getList, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, interpolatedConfiguration, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setListDelimiterHandler, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setPropertyInternal, setSynchronizer, setThrowExceptionOnMissing, size, sizeInternal, subset, unlock`

    - ### Methods inherited from class org.apache.commons.configuration2.event.BaseEventSource

      `addEventListener, clearErrorListeners, clearEventListeners, clone, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents`

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

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

- - ### Field Detail

    - #### context

          protected ServletContext context

      Stores the wrapped servlet context.

  - ### Constructor Detail

    - #### ServletContextConfiguration

          public ServletContextConfiguration(Servlet servlet)

      Create a ServletContextConfiguration using the context of the specified servlet.
      Parameters:
        `servlet` - the servlet

    - #### ServletContextConfiguration

          public ServletContextConfiguration(ServletContext context)

      Create a ServletContextConfiguration using the servlet context initialization parameters.
      Parameters:
        `context` - the servlet context

  - ### Method Detail

    - #### getPropertyInternal

          protected Object getPropertyInternal(String key)

      Description copied from class: `AbstractConfiguration`
      Actually obtains the value of the specified property. This method is called by `getProperty()`. Concrete subclasses must define it to fetch the value of the desired property.
      Specified by:
        `getPropertyInternal` in class `AbstractConfiguration`
      Parameters:
        `key` - the key of the property in question
      Returns:
        the (raw) value of this property

    - #### getKeysInternal

          protected Iterator<String> getKeysInternal()

      Description copied from class: `AbstractConfiguration`
      Actually creates an iterator for iterating over the keys in this configuration. This method is called by `getKeys()`, it has to be defined by concrete subclasses.
      Specified by:
        `getKeysInternal` in class `AbstractConfiguration`
      Returns:
        an `Iterator` with all property keys in this configuration

    - #### isEmptyInternal

          protected boolean isEmptyInternal()

      Checks if this configuration is empty. This implementation makes use of the `getKeys()` method (which must be defined by concrete sub classes) to find out whether properties exist.
      Specified by:
        `isEmptyInternal` in class `AbstractConfiguration`
      Returns:
        a flag whether this configuration is empty

    - #### containsKeyInternal

          protected boolean containsKeyInternal(String key)

      Checks whether the specified key is stored in this configuration.
      Specified by:
        `containsKeyInternal` in class `AbstractConfiguration`
      Parameters:
        `key` - the key
      Returns:
        a flag whether this key exists in this configuration

    - #### clearPropertyDirect

          protected void clearPropertyDirect(String key)

      Removes the property with the given key. This operation is not supported and will throw an UnsupportedOperationException.
      Specified by:
        `clearPropertyDirect` in class `AbstractConfiguration`
      Parameters:
        `key` - the key of the property to be removed
      Throws:
        `UnsupportedOperationException` - because this operation is not allowed

    - #### addPropertyDirect

          protected void addPropertyDirect(String key,
                                           Object obj)

      Adds a property to this configuration. This operation is not supported and will throw an UnsupportedOperationException.
      Specified by:
        `addPropertyDirect` in class `AbstractConfiguration`
      Parameters:
        `key` - the key of the property
        `obj` - the value to be added
      Throws:
        `UnsupportedOperationException` - because this operation is not allowed

    - #### handleDelimiters

          protected Object handleDelimiters(Object value)

      Takes care of list delimiters in property values. This method checks if delimiter parsing is enabled and the passed in value contains a delimiter character. If this is the case, a split operation is performed.
      Parameters:
        `value` - the property value to be examined
      Returns:
        the processed value

Copyright © 2001–2016 The Apache Software Foundation. All rights reserved.