Class BaseUriDecorator

  • All Implemented Interfaces:
    Decorator

    public class BaseUriDecorator
    extends AbstractDecorator
    The baseURI decorator can decorate both Filter and Handler instances.

    It has to be declared inside of the heap objects section:

         
         {
           "name": "myBaseUri",
           "type": "BaseUriDecorator"
         }
         
     
    To decorate a component, just add the decorator declaration next to the config element:
         
         {
           "type": "...",
           "myBaseUri": "http://www.example.com",
           "config": { ... }
         }
         
     

    The baseURI has to be a string otherwise, the decoration will be ignored.

    N.B: The Gateway Servlet creates a default BaseUriDecorator named "baseURI" at startup time.

    • Constructor Detail

      • BaseUriDecorator

        public BaseUriDecorator​(String name)
        Builds a new BaseUriDecorator.
        Parameters:
        name - The name of this decorator.
    • Method Detail

      • accepts

        public boolean accepts​(Class<?> type)
        Description copied from interface: Decorator
        Returns true if this decorator is compatible with the provided component type. Note that a return value of true does not necessarily indicate that decoration will be performed since it may also depend on other factors
        Parameters:
        type - type under test
        Returns:
        true if the decorator can decorate instance of the given type, false otherwise.
      • decorate

        public DecorationHandle decorate​(Object delegate,
                                         JsonValue decoratorConfig,
                                         Context context)
                                  throws HeapException
        Description copied from interface: Decorator
        Decorates the provided delegate instance with the provided decoratorConfig configuration. The implementation should take care of not changing the base type of the delegate.
        Parameters:
        delegate - instance to be decorated
        decoratorConfig - the decorator configuration to apply
        context - contextual information of the decorated instance
        Returns:
        a handle of the decoration that was setup, never null.
        Throws:
        HeapException - when decoration fails