# Class WebXml

java.lang.Object
org.apache.tomcat.util.descriptor.web.XmlEncodingBase
org.apache.tomcat.util.descriptor.web.WebXml

All Implemented Interfaces:
  `DocumentProperties.Charset`

public class WebXml extends XmlEncodingBase implements DocumentProperties.Charset
Representation of common elements of web.xml and web-fragment.xml. Provides a repository for parsed data before the elements are merged. Validation is spread between multiple classes: The digester checks for structural correctness (e.g. single login-config) This class checks for invalid duplicates (e.g. filter/servlet names) StandardContext will check validity of values (e.g. URL formats etc)

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String`
  `ORDER_OTHERS`
  Marker for "others" in ordering.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WebXml()`
  Constructs a new WebXml.
  `WebXml(boolean urlPatternsProvidedInDecodedForm)`
  Deprecated.
  This constructor will be removed in Tomcat 12

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAbsoluteOrdering(String fragmentName)`
  Adds a fragment name to the absolute ordering.
  `void`
  `addAbsoluteOrderingOthers()`
  Adds "others" to the absolute ordering.
  `void`
  `addAfterOrdering(String fragmentName)`
  Adds a fragment name to the after ordering.
  `void`
  `addAfterOrderingOthers()`
  Adds "others" to the after ordering.
  `void`
  `addBeforeOrdering(String fragmentName)`
  Adds a fragment name to the before ordering.
  `void`
  `addBeforeOrderingOthers()`
  Adds "others" to the before ordering.
  `void`
  `addContextParam(String param, String value)`
  Adds a context parameter.
  `void`
  `addDuplicate(String duplicate)`
  Adds a duplicate fragment name.
  `void`
  `addEjbLocalRef(ContextLocalEjb ejbLocalRef)`
  Adds an EJB local reference.
  `void`
  `addEjbRef(ContextEjb ejbRef)`
  Adds an EJB reference.
  `void`
  `addEnvEntry(ContextEnvironment envEntry)`
  Adds an environment entry.
  `void`
  `addErrorPage(ErrorPage errorPage)`
  Adds an error page.
  `void`
  `addFilter(FilterDef filter)`
  Adds a filter definition.
  `void`
  `addFilterMapping(FilterMap filterMap)`
  Adds a filter mapping.
  `void`
  `addJspPropertyGroup(JspPropertyGroup propertyGroup)`
  Adds a JSP property group.
  `void`
  `addListener(String className)`
  Adds a listener class.
  `void`
  `addLocaleEncodingMapping(String locale, String encoding)`
  Adds a locale-encoding mapping.
  `void`
  `addMessageDestination(MessageDestination messageDestination)`
  Adds a message destination.
  `void`
  `addMessageDestinationRef(MessageDestinationRef messageDestinationRef)`
  Adds a message destination reference.
  `void`
  `addMimeMapping(String extension, String mimeType)`
  Adds a MIME mapping.
  `void`
  `addPostConstructMethods(String clazz, String method)`
  Adds a post-construct method.
  `void`
  `addPreDestroyMethods(String clazz, String method)`
  Adds a pre-destroy method.
  `void`
  `addResourceEnvRef(ContextResourceEnvRef resourceEnvRef)`
  Adds a resource environment reference.
  `void`
  `addResourceRef(ContextResource resourceRef)`
  Adds a resource reference.
  `void`
  `addSecurityConstraint(SecurityConstraint securityConstraint)`
  Adds a security constraint.
  `void`
  `addSecurityRole(String securityRole)`
  Adds a security role.
  `void`
  `addServiceRef(ContextService serviceRef)`
  Adds a service reference.
  `void`
  `addServlet(ServletDef servletDef)`
  Adds a servlet definition.
  `void`
  `addServletMapping(String urlPattern, String servletName)`
  Adds a servlet URL mapping.
  `void`
  `addServletMappingDecoded(String urlPattern, String servletName)`
  Deprecated.
  Will be removed in Tomcat 12 onwards
  `void`
  `addTaglib(String uri, String location)`
  Adds a taglib mapping.
  `void`
  `addWelcomeFile(String welcomeFile)`
  Adds a welcome file.
  `void`
  `createAbsoluteOrdering()`
  Initializes the absolute ordering set if it has not been created yet.
  `Set<String>`
  `getAbsoluteOrdering()`
  Returns the absolute ordering set.
  `Set<String>`
  `getAfterOrdering()`
  Returns the after ordering set.
  `Set<String>`
  `getBeforeOrdering()`
  Returns the before ordering set.
  `Map<String,String>`
  `getContextParams()`
  Returns the context parameters.
  `boolean`
  `getDelegate()`
  Returns whether this web application delegates first for class loading.
  `boolean`
  `getDenyUncoveredHttpMethods()`
  Returns whether uncovered HTTP methods are denied.
  `String`
  `getDisplayName()`
  Returns the display name of the web application.
  `List<String>`
  `getDuplicates()`
  Returns the list of duplicate fragment names.
  `Map<String, ContextLocalEjb>`
  `getEjbLocalRefs()`
  Returns the EJB local references.
  `Map<String, ContextEjb>`
  `getEjbRefs()`
  Returns the EJB references.
  `Map<String, ContextEnvironment>`
  `getEnvEntries()`
  Returns the environment entries.
  `Map<String, ErrorPage>`
  `getErrorPages()`
  Returns the error pages.
  `Set<FilterMap>`
  `getFilterMappings()`
  Returns the filter mappings.
  `Map<String, FilterDef>`
  `getFilters()`
  Returns the filter definitions.
  `String`
  `getJarName()`
  Returns the JAR name for this web fragment.
  `JspConfigDescriptor`
  `getJspConfigDescriptor()`
  Returns the JSP configuration descriptor.
  `Set<JspPropertyGroup>`
  `getJspPropertyGroups()`
  Returns the JSP property groups.
  `Set<String>`
  `getListeners()`
  Returns the listener class names.
  `Map<String,String>`
  `getLocaleEncodingMappings()`
  Returns the locale-encoding mappings.
  `LoginConfig`
  `getLoginConfig()`
  Returns the login configuration.
  `int`
  `getMajorVersion()`
  Returns the major version number.
  `Map<String, MessageDestinationRef>`
  `getMessageDestinationRefs()`
  Returns the message destination references.
  `Map<String, MessageDestination>`
  `getMessageDestinations()`
  Returns the message destinations.
  `Map<String,String>`
  `getMimeMappings()`
  Returns the MIME mappings.
  `int`
  `getMinorVersion()`
  Returns the minor version number.
  `String`
  `getName()`
  Returns the name of the web application.
  `Map<String,String>`
  `getPostConstructMethods()`
  Returns the post-construct methods.
  `Map<String,String>`
  `getPreDestroyMethods()`
  Returns the pre-destroy methods.
  `String`
  `getPublicId()`
  Returns the public identifier.
  `String`
  `getRequestCharacterEncoding()`
  Returns the request character encoding.
  `Map<String, ContextResourceEnvRef>`
  `getResourceEnvRefs()`
  Returns the resource environment references.
  `Map<String, ContextResource>`
  `getResourceRefs()`
  Returns the resource references.
  `String`
  `getResponseCharacterEncoding()`
  Returns the response character encoding.
  `Set<SecurityConstraint>`
  `getSecurityConstraints()`
  Returns the security constraints.
  `Set<String>`
  `getSecurityRoles()`
  Returns the security roles.
  `Map<String, ContextService>`
  `getServiceRefs()`
  Returns the service references.
  `Map<String,String>`
  `getServletMappings()`
  Returns the servlet URL mappings.
  `Map<String, ServletDef>`
  `getServlets()`
  Returns the servlet definitions.
  `SessionConfig`
  `getSessionConfig()`
  Returns the session configuration.
  `Map<String,String>`
  `getTaglibs()`
  Returns the taglib mappings.
  `URL`
  `getURL()`
  Returns the URL of the web.xml.
  `boolean`
  `getUrlPatternsProvidedInDecodedForm()`
  Deprecated.
  This method will be removed in Tomcat 12 where the field will be effectively hard-coded to `true`
  `String`
  `getVersion()`
  Returns the version of the web.xml.
  `boolean`
  `getWebappJar()`
  Returns whether this descriptor came from a webapp JAR.
  `Set<String>`
  `getWelcomeFiles()`
  Returns the welcome files.
  `boolean`
  `isDistributable()`
  Returns whether the web application is distributable.
  `boolean`
  `isDuplicated()`
  Returns whether this web fragment has duplicate entries.
  `boolean`
  `isMetadataComplete()`
  Returns whether metadata is complete.
  `boolean`
  `isOverridable()`
  Returns whether this web fragment is overridable.
  `boolean`
  `merge(Set<WebXml> fragments)`
  Merge the supplied web fragments into this main web.xml.
  `static Set<WebXml>`
  `orderWebFragments(WebXml application, Map<String,WebXml> fragments, ServletContext servletContext)`
  Generates the sub-set of the web-fragment.xml files to be processed in the order that the fragments must be processed as per the rules in the Servlet spec.
  `void`
  `setAlwaysAddWelcomeFiles(boolean alwaysAddWelcomeFiles)`
  When merging from this web.xml, should the welcome files be added to the target web.xml even if it already contains welcome file definitions.
  `void`
  `setDelegate(boolean delegate)`
  Sets whether this web application delegates first for class loading.
  `void`
  `setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)`
  Sets whether uncovered HTTP methods are denied.
  `void`
  `setDisplayName(String displayName)`
  Sets the display name.
  `void`
  `setDistributable(boolean distributable)`
  Sets whether the web application is distributable.
  `void`
  `setJarName(String jarName)`
  Sets the JAR name for this web fragment.
  `void`
  `setLoginConfig(LoginConfig loginConfig)`
  Sets the login configuration.
  `void`
  `setMetadataComplete(boolean metadataComplete)`
  Sets whether metadata is complete.
  `void`
  `setName(String name)`
  Sets the name of the web application.
  `void`
  `setOverridable(boolean overridable)`
  Sets whether this web fragment is overridable.
  `void`
  `setPublicId(String publicId)`
  Sets the public identifier.
  `void`
  `setReplaceWelcomeFiles(boolean replaceWelcomeFiles)`
  Sets whether welcome files should replace existing ones.
  `void`
  `setRequestCharacterEncoding(String requestCharacterEncoding)`
  Sets the request character encoding.
  `void`
  `setResponseCharacterEncoding(String responseCharacterEncoding)`
  Sets the response character encoding.
  `void`
  `setSessionConfig(SessionConfig sessionConfig)`
  Sets the session configuration.
  `void`
  `setURL(URL url)`
  Sets the URL of the web.xml.
  `void`
  `setVersion(String version)`
  Set the version for this web.xml file
  `void`
  `setWebappJar(boolean webappJar)`
  Sets whether this descriptor came from a webapp JAR.
  `String`
  `toString()`
  `String`
  `toXml()`
  Generate a web.xml in String form that matches the representation stored in this object.

  ### Methods inherited from class XmlEncodingBase

  `getCharset, setCharset`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface DocumentProperties.Charset

  `setCharset`

- ## Field Details

  - ### ORDER_OTHERS

    protected static final String ORDER_OTHERS
    Marker for "others" in ordering.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WebXml

    public WebXml()
    Constructs a new WebXml.

  - ### WebXml

    @Deprecated public WebXml(boolean urlPatternsProvidedInDecodedForm)
    Deprecated.
    This constructor will be removed in Tomcat 12
    Constructs a new WebXml with configurable behaviour for URL and URL pattern decoding.
    Parameters:
      `urlPatternsProvidedInDecodedForm` - `true` if URLs and URL patterns are expected to be decoded. `false` if they are expected to be URL-encoded (i.e. `%nn` encoding)

- ## Method Details

  - ### getUrlPatternsProvidedInDecodedForm

    @Deprecated public boolean getUrlPatternsProvidedInDecodedForm()
    Deprecated.
    This method will be removed in Tomcat 12 where the field will be effectively hard-coded to `true`
    Does this Context expect URLs and URL patterns provided in web.xml, annotations and their programmatic equivalents to be in URL-decoded form?

    As per the Servlet specification, "URI paths specified in the deployment descriptor are assumed to be in URL-decoded form.".

    Returns:
      `true` if URLs and URL patterns are expected in URL-decoded form, otherwise `false`

  - ### isOverridable

    public boolean isOverridable()
    Returns whether this web fragment is overridable.
    Returns:
      `true` if overridable

  - ### setOverridable

    public void setOverridable(boolean overridable)
    Sets whether this web fragment is overridable.
    Parameters:
      `overridable` - The overridable flag

  - ### isDuplicated

    public boolean isDuplicated()
    Returns whether this web fragment has duplicate entries.
    Returns:
      `true` if duplicates exist

  - ### addDuplicate

    public void addDuplicate(String duplicate)
    Adds a duplicate fragment name.
    Parameters:
      `duplicate` - The duplicate fragment name

  - ### getDuplicates

    public List<String> getDuplicates()
    Returns the list of duplicate fragment names.
    Returns:
      the duplicate fragment names

  - ### createAbsoluteOrdering

    public void createAbsoluteOrdering()
    Initializes the absolute ordering set if it has not been created yet.

  - ### addAbsoluteOrdering

    public void addAbsoluteOrdering(String fragmentName)
    Adds a fragment name to the absolute ordering.
    Parameters:
      `fragmentName` - The fragment name to add

  - ### addAbsoluteOrderingOthers

    public void addAbsoluteOrderingOthers()
    Adds "others" to the absolute ordering.

  - ### getAbsoluteOrdering

    public Set<String> getAbsoluteOrdering()
    Returns the absolute ordering set.
    Returns:
      the absolute ordering

  - ### addAfterOrdering

    public void addAfterOrdering(String fragmentName)
    Adds a fragment name to the after ordering.
    Parameters:
      `fragmentName` - The fragment name to add

  - ### addAfterOrderingOthers

    public void addAfterOrderingOthers()
    Adds "others" to the after ordering.
    Throws:
      `IllegalArgumentException` - If "others" is already in the before ordering

  - ### getAfterOrdering

    public Set<String> getAfterOrdering()
    Returns the after ordering set.
    Returns:
      the after ordering

  - ### addBeforeOrdering

    public void addBeforeOrdering(String fragmentName)
    Adds a fragment name to the before ordering.
    Parameters:
      `fragmentName` - The fragment name to add

  - ### addBeforeOrderingOthers

    public void addBeforeOrderingOthers()
    Adds "others" to the before ordering.
    Throws:
      `IllegalArgumentException` - If "others" is already in the after ordering

  - ### getBeforeOrdering

    public Set<String> getBeforeOrdering()
    Returns the before ordering set.
    Returns:
      the before ordering

  - ### getVersion

    public String getVersion()
    Returns the version of the web.xml.
    Returns:
      the version

  - ### setVersion

    public void setVersion(String version)
    Set the version for this web.xml file
    Parameters:
      `version` - Values of `null` will be ignored

  - ### getPublicId

    public String getPublicId()
    Returns the public identifier.
    Returns:
      the public identifier

  - ### setPublicId

    public void setPublicId(String publicId)
    Sets the public identifier.
    Parameters:
      `publicId` - The public identifier

  - ### isMetadataComplete

    public boolean isMetadataComplete()
    Returns whether metadata is complete.
    Returns:
      `true` if metadata is complete

  - ### setMetadataComplete

    public void setMetadataComplete(boolean metadataComplete)
    Sets whether metadata is complete.
    Parameters:
      `metadataComplete` - The metadata complete flag

  - ### getName

    public String getName()
    Returns the name of the web application.
    Returns:
      the name

  - ### setName

    public void setName(String name)
    Sets the name of the web application.
    Parameters:
      `name` - The name

  - ### getMajorVersion

    public int getMajorVersion()
    Returns the major version number.
    Returns:
      the major version

  - ### getMinorVersion

    public int getMinorVersion()
    Returns the minor version number.
    Returns:
      the minor version

  - ### getDisplayName

    public String getDisplayName()
    Returns the display name of the web application.
    Returns:
      the display name

  - ### setDisplayName

    public void setDisplayName(String displayName)
    Sets the display name.
    Parameters:
      `displayName` - The display name

  - ### isDistributable

    public boolean isDistributable()
    Returns whether the web application is distributable.
    Returns:
      `true` if distributable

  - ### setDistributable

    public void setDistributable(boolean distributable)
    Sets whether the web application is distributable.
    Parameters:
      `distributable` - The distributable flag

  - ### getDenyUncoveredHttpMethods

    public boolean getDenyUncoveredHttpMethods()
    Returns whether uncovered HTTP methods are denied.
    Returns:
      `true` if uncovered HTTP methods are denied

  - ### setDenyUncoveredHttpMethods

    public void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)
    Sets whether uncovered HTTP methods are denied.
    Parameters:
      `denyUncoveredHttpMethods` - The deny uncovered HTTP methods flag

  - ### addContextParam

    public void addContextParam(String param, String value)
    Adds a context parameter.
    Parameters:
      `param` - The parameter name
      `value` - The parameter value

  - ### getContextParams

    public Map<String,String> getContextParams()
    Returns the context parameters.
    Returns:
      the context parameters

  - ### addFilter

    public void addFilter(FilterDef filter)
    Adds a filter definition.
    Parameters:
      `filter` - The filter definition
    Throws:
      `IllegalArgumentException` - If a filter with the same name already exists

  - ### getFilters

    public Map<String, FilterDef> getFilters()
    Returns the filter definitions.
    Returns:
      the filter definitions

  - ### addFilterMapping

    public void addFilterMapping(FilterMap filterMap)
    Adds a filter mapping.
    Parameters:
      `filterMap` - The filter mapping

  - ### getFilterMappings

    public Set<FilterMap> getFilterMappings()
    Returns the filter mappings.
    Returns:
      the filter mappings

  - ### addListener

    public void addListener(String className)
    Adds a listener class.
    Parameters:
      `className` - The listener class name

  - ### getListeners

    public Set<String> getListeners()
    Returns the listener class names.
    Returns:
      the listener class names

  - ### addServlet

    public void addServlet(ServletDef servletDef)
    Adds a servlet definition.
    Parameters:
      `servletDef` - The servlet definition

  - ### getServlets

    public Map<String, ServletDef> getServlets()
    Returns the servlet definitions.
    Returns:
      the servlet definitions

  - ### addServletMapping

    public void addServletMapping(String urlPattern, String servletName)
    Adds a servlet URL mapping.
    Parameters:
      `urlPattern` - The URL pattern
      `servletName` - The servlet name

  - ### addServletMappingDecoded

    @Deprecated public void addServletMappingDecoded(String urlPattern, String servletName)
    Deprecated.
    Will be removed in Tomcat 12 onwards
    Adds a servlet URL mapping (already decoded).
    Parameters:
      `urlPattern` - The URL pattern
      `servletName` - The servlet name
    Throws:
      `IllegalArgumentException` - If a duplicate mapping exists

  - ### getServletMappings

    public Map<String,String> getServletMappings()
    Returns the servlet URL mappings.
    Returns:
      the servlet mappings

  - ### setSessionConfig

    public void setSessionConfig(SessionConfig sessionConfig)
    Sets the session configuration.
    Parameters:
      `sessionConfig` - The session configuration

  - ### getSessionConfig

    public SessionConfig getSessionConfig()
    Returns the session configuration.
    Returns:
      the session configuration

  - ### addMimeMapping

    public void addMimeMapping(String extension, String mimeType)
    Adds a MIME mapping.
    Parameters:
      `extension` - The file extension
      `mimeType` - The MIME type

  - ### getMimeMappings

    public Map<String,String> getMimeMappings()
    Returns the MIME mappings.
    Returns:
      the MIME mappings

  - ### setReplaceWelcomeFiles

    public void setReplaceWelcomeFiles(boolean replaceWelcomeFiles)
    Sets whether welcome files should replace existing ones.
    Parameters:
      `replaceWelcomeFiles` - The replace welcome files flag

  - ### setAlwaysAddWelcomeFiles

    public void setAlwaysAddWelcomeFiles(boolean alwaysAddWelcomeFiles)
    When merging from this web.xml, should the welcome files be added to the target web.xml even if it already contains welcome file definitions.
    Parameters:
      `alwaysAddWelcomeFiles` - `true` to add welcome files

  - ### addWelcomeFile

    public void addWelcomeFile(String welcomeFile)
    Adds a welcome file.
    Parameters:
      `welcomeFile` - The welcome file name

  - ### getWelcomeFiles

    public Set<String> getWelcomeFiles()
    Returns the welcome files.
    Returns:
      the welcome files

  - ### addErrorPage

    public void addErrorPage(ErrorPage errorPage)
    Adds an error page.
    Parameters:
      `errorPage` - The error page

  - ### getErrorPages

    public Map<String, ErrorPage> getErrorPages()
    Returns the error pages.
    Returns:
      the error pages

  - ### addTaglib

    public void addTaglib(String uri, String location)
    Adds a taglib mapping.
    Parameters:
      `uri` - The taglib URI
      `location` - The taglib location

  - ### getTaglibs

    public Map<String,String> getTaglibs()
    Returns the taglib mappings.
    Returns:
      the taglib mappings

  - ### addJspPropertyGroup

    public void addJspPropertyGroup(JspPropertyGroup propertyGroup)
    Adds a JSP property group.
    Parameters:
      `propertyGroup` - The JSP property group

  - ### getJspPropertyGroups

    public Set<JspPropertyGroup> getJspPropertyGroups()
    Returns the JSP property groups.
    Returns:
      the JSP property groups

  - ### addSecurityConstraint

    public void addSecurityConstraint(SecurityConstraint securityConstraint)
    Adds a security constraint.
    Parameters:
      `securityConstraint` - The security constraint

  - ### getSecurityConstraints

    public Set<SecurityConstraint> getSecurityConstraints()
    Returns the security constraints.
    Returns:
      the security constraints

  - ### setLoginConfig

    public void setLoginConfig(LoginConfig loginConfig)
    Sets the login configuration.
    Parameters:
      `loginConfig` - The login configuration

  - ### getLoginConfig

    public LoginConfig getLoginConfig()
    Returns the login configuration.
    Returns:
      the login configuration

  - ### addSecurityRole

    public void addSecurityRole(String securityRole)
    Adds a security role.
    Parameters:
      `securityRole` - The security role name

  - ### getSecurityRoles

    public Set<String> getSecurityRoles()
    Returns the security roles.
    Returns:
      the security roles

  - ### addEnvEntry

    public void addEnvEntry(ContextEnvironment envEntry)
    Adds an environment entry.
    Parameters:
      `envEntry` - The environment entry
    Throws:
      `IllegalArgumentException` - If an entry with the same name already exists

  - ### getEnvEntries

    public Map<String, ContextEnvironment> getEnvEntries()
    Returns the environment entries.
    Returns:
      the environment entries

  - ### addEjbRef

    public void addEjbRef(ContextEjb ejbRef)
    Adds an EJB reference.
    Parameters:
      `ejbRef` - The EJB reference

  - ### getEjbRefs

    public Map<String, ContextEjb> getEjbRefs()
    Returns the EJB references.
    Returns:
      the EJB references

  - ### addEjbLocalRef

    public void addEjbLocalRef(ContextLocalEjb ejbLocalRef)
    Adds an EJB local reference.
    Parameters:
      `ejbLocalRef` - The EJB local reference

  - ### getEjbLocalRefs

    public Map<String, ContextLocalEjb> getEjbLocalRefs()
    Returns the EJB local references.
    Returns:
      the EJB local references

  - ### addServiceRef

    public void addServiceRef(ContextService serviceRef)
    Adds a service reference.
    Parameters:
      `serviceRef` - The service reference

  - ### getServiceRefs

    public Map<String, ContextService> getServiceRefs()
    Returns the service references.
    Returns:
      the service references

  - ### addResourceRef

    public void addResourceRef(ContextResource resourceRef)
    Adds a resource reference.
    Parameters:
      `resourceRef` - The resource reference
    Throws:
      `IllegalArgumentException` - If a reference with the same name already exists

  - ### getResourceRefs

    public Map<String, ContextResource> getResourceRefs()
    Returns the resource references.
    Returns:
      the resource references

  - ### addResourceEnvRef

    public void addResourceEnvRef(ContextResourceEnvRef resourceEnvRef)
    Adds a resource environment reference.
    Parameters:
      `resourceEnvRef` - The resource environment reference
    Throws:
      `IllegalArgumentException` - If a reference with the same name already exists

  - ### getResourceEnvRefs

    public Map<String, ContextResourceEnvRef> getResourceEnvRefs()
    Returns the resource environment references.
    Returns:
      the resource environment references

  - ### addMessageDestinationRef

    public void addMessageDestinationRef(MessageDestinationRef messageDestinationRef)
    Adds a message destination reference.
    Parameters:
      `messageDestinationRef` - The message destination reference
    Throws:
      `IllegalArgumentException` - If a reference with the same name already exists

  - ### getMessageDestinationRefs

    public Map<String, MessageDestinationRef> getMessageDestinationRefs()
    Returns the message destination references.
    Returns:
      the message destination references

  - ### addMessageDestination

    public void addMessageDestination(MessageDestination messageDestination)
    Adds a message destination.
    Parameters:
      `messageDestination` - The message destination
    Throws:
      `IllegalArgumentException` - If a destination with the same name already exists

  - ### getMessageDestinations

    public Map<String, MessageDestination> getMessageDestinations()
    Returns the message destinations.
    Returns:
      the message destinations

  - ### addLocaleEncodingMapping

    public void addLocaleEncodingMapping(String locale, String encoding)
    Adds a locale-encoding mapping.
    Parameters:
      `locale` - The locale
      `encoding` - The encoding

  - ### getLocaleEncodingMappings

    public Map<String,String> getLocaleEncodingMappings()
    Returns the locale-encoding mappings.
    Returns:
      the locale-encoding mappings

  - ### addPostConstructMethods

    public void addPostConstructMethods(String clazz, String method)
    Adds a post-construct method.
    Parameters:
      `clazz` - The class name
      `method` - The method name

  - ### getPostConstructMethods

    public Map<String,String> getPostConstructMethods()
    Returns the post-construct methods.
    Returns:
      the post-construct methods

  - ### addPreDestroyMethods

    public void addPreDestroyMethods(String clazz, String method)
    Adds a pre-destroy method.
    Parameters:
      `clazz` - The class name
      `method` - The method name

  - ### getPreDestroyMethods

    public Map<String,String> getPreDestroyMethods()
    Returns the pre-destroy methods.
    Returns:
      the pre-destroy methods

  - ### getJspConfigDescriptor

    public JspConfigDescriptor getJspConfigDescriptor()
    Returns the JSP configuration descriptor.
    Returns:
      the JSP configuration descriptor

  - ### getRequestCharacterEncoding

    public String getRequestCharacterEncoding()
    Returns the request character encoding.
    Returns:
      the request character encoding

  - ### setRequestCharacterEncoding

    public void setRequestCharacterEncoding(String requestCharacterEncoding)
    Sets the request character encoding.
    Parameters:
      `requestCharacterEncoding` - The request character encoding

  - ### getResponseCharacterEncoding

    public String getResponseCharacterEncoding()
    Returns the response character encoding.
    Returns:
      the response character encoding

  - ### setResponseCharacterEncoding

    public void setResponseCharacterEncoding(String responseCharacterEncoding)
    Sets the response character encoding.
    Parameters:
      `responseCharacterEncoding` - The response character encoding

  - ### setURL

    public void setURL(URL url)
    Sets the URL of the web.xml.
    Parameters:
      `url` - The URL

  - ### getURL

    public URL getURL()
    Returns the URL of the web.xml.
    Returns:
      the URL

  - ### setJarName

    public void setJarName(String jarName)
    Sets the JAR name for this web fragment.
    Parameters:
      `jarName` - The JAR name

  - ### getJarName

    public String getJarName()
    Returns the JAR name for this web fragment.
    Returns:
      the JAR name

  - ### setWebappJar

    public void setWebappJar(boolean webappJar)
    Sets whether this descriptor came from a webapp JAR.
    Parameters:
      `webappJar` - The webapp JAR flag

  - ### getWebappJar

    public boolean getWebappJar()
    Returns whether this descriptor came from a webapp JAR.
    Returns:
      `true` if from a webapp JAR

  - ### getDelegate

    public boolean getDelegate()
    Returns whether this web application delegates first for class loading.
    Returns:
      `true` if delegation is enabled

  - ### setDelegate

    public void setDelegate(boolean delegate)
    Sets whether this web application delegates first for class loading.
    Parameters:
      `delegate` - The delegate flag

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toXml

    public String toXml()
    Generate a web.xml in String form that matches the representation stored in this object.
    Returns:
      The complete contents of web.xml as a String

  - ### merge

    public boolean merge(Set<WebXml> fragments)
    Merge the supplied web fragments into this main web.xml.
    Parameters:
      `fragments` - The fragments to merge in
    Returns:
      `true` if merge is successful, else `false`

  - ### orderWebFragments

    public static Set<WebXml> orderWebFragments(WebXml application, Map<String,WebXml> fragments, ServletContext servletContext)
    Generates the sub-set of the web-fragment.xml files to be processed in the order that the fragments must be processed as per the rules in the Servlet spec.
    Parameters:
      `application` - The application web.xml file
      `fragments` - The map of fragment names to web fragments
      `servletContext` - The servlet context the fragments are associated with
    Returns:
      Ordered list of web-fragment.xml files to process