Class HttpRequestHeadersAttribute

All Implemented Interfaces:
Attribute, ConfigurationObject

public final class HttpRequestHeadersAttribute extends ReflectiveAttribute<HttpRequestHeadersAttribute.Value>
Attribute representing the headers from the request.

This is an internal attribute and is added to the system automatically. It does not need to be added in the config.yaml file.

  • Constructor Details

    • HttpRequestHeadersAttribute

      public HttpRequestHeadersAttribute()
      Constructor that calls init.
  • Method Details

    • getValueType

      public Class<HttpRequestHeadersAttribute.Value> getValueType()
      Description copied from class: ReflectiveAttribute
      Return the type created by ReflectiveAttribute.createValue(Template).
      Specified by:
      getValueType in interface Attribute
      Specified by:
      getValueType in class ReflectiveAttribute<HttpRequestHeadersAttribute.Value>
      Returns:
      the value class
    • createValue

      public HttpRequestHeadersAttribute.Value createValue(Template template)
      Description copied from class: ReflectiveAttribute
      Create an instance of a attribute value object. Each instance must be new and unique. Instances must NOT be shared.

      The object will be populated from the json. Each public field will be populated by looking up the value in the json.

      If a field in the object has the HasDefaultValue annotation then no exception will be thrown if the json does not contain a value.

      Fields in the object with the OneOf annotation must have one of the fields in the request data.

      If there is a public "postConstruct"() method then it will be called after the fields are all set.

      In the case where the a parameter type is a normal POJO (not a special case like PJsonObject, URL, enum, double, etc...) then it will be assumed that the json data is a json object and the parameters will be recursively parsed into the new object as if it is also MapLayer parameter object.

      It is important to put values in the value object as public fields because reflection is used when printing client config as well as generating documentation. If a field is intended for the client software as information but is not intended to be set (or sent as part of the request data), the field can be a final field.

      Specified by:
      createValue in class ReflectiveAttribute<HttpRequestHeadersAttribute.Value>
      Parameters:
      template - the template that this attribute is part of.
    • validate

      public void validate(List<Throwable> validationErrors, Configuration configuration)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Parameters:
      validationErrors - a list to add any detected errors to.
      configuration - the containing configuration