Class WebContext.Builder

java.lang.Object
org.opendaylight.aaa.web.WebContext.Builder
Enclosing interface:
WebContext

public static final class WebContext.Builder extends Object
Builds instances of type WebContext. Initialize attributes and then invoke the build() method to create an immutable instance.

WebContext.Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • name

      public @NonNull WebContext.Builder name(String name)
      Initializes the value for the name attribute.
      Parameters:
      name - A descriptive name
      Returns:
      this builder for use in a chained invocation
      Throws:
      IllegalArgumentException - if contextPath does not meet specification criteria
      NullPointerException - if {code contextPath} is null
    • contextPath

      public @NonNull WebContext.Builder contextPath(String contextPath)
      Initializes the value for the contextPath attribute. As per Servlet specification.
      Parameters:
      contextPath - The value for contextPath
      Returns:
      this builder for use in a chained invocation
      Throws:
      IllegalArgumentException - if contextPath does not meet specification criteria
      NullPointerException - if {code contextPath} is null
    • addServlet

      public @NonNull WebContext.Builder addServlet(ServletDetails servlet)
      Adds one element to servlets list.
      Parameters:
      servlet - A servlets element
      Returns:
      this builder for use in a chained invocation
      Throws:
      NullPointerException - if {code servlet} is null
    • addFilter

      public @NonNull WebContext.Builder addFilter(FilterDetails filter)
      Adds one element to filters list.
      Parameters:
      filter - A filters element
      Returns:
      this builder for use in a chained invocation
      Throws:
      NullPointerException - if {code filter} is null
    • addListener

      public @NonNull WebContext.Builder addListener(javax.servlet.ServletContextListener listener)
      Adds one element to listeners list.
      Parameters:
      listener - A listeners element
      Returns:
      this builder for use in a chained invocation
      Throws:
      NullPointerException - if {code listener} is null
    • addResource

      public @NonNull WebContext.Builder addResource(ResourceDetails resource)
      Adds one element to resources list.
      Parameters:
      resource - A resources element
      Returns:
      this builder for use in a chained invocation
      Throws:
      NullPointerException - if {code resource} is null
    • putContextParam

      public @NonNull WebContext.Builder putContextParam(String key, String value)
      Put one entry to the contextParams map.
      Parameters:
      key - The key in the contextParams map
      value - The associated value in the contextParams map
      Returns:
      this builder for use in a chained invocation
      Throws:
      NullPointerException - if any argument is null
    • supportsSessions

      public WebContext.Builder supportsSessions(boolean supportsSessions)
      Initializes the value for the supportsSessions attribute.

      If not set, this attribute will have a default value of true.

      Parameters:
      supportsSessions - The value for supportsSessions
      Returns:
      this builder for use in a chained invocation
    • build

      public @NonNull WebContext build()
      Builds a new WebContext.
      Returns:
      An immutable instance of WebContext
      Throws:
      IllegalStateException - if any required attributes are missing