Class 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 (eg single login-config) This class checks for invalid duplicates (eg filter/servlet names) StandardContext will check validity of values (eg URL formats etc)
    • Constructor Detail

      • WebXml

        public WebXml()
    • Method Detail

      • isOverridable

        public boolean isOverridable()
      • setOverridable

        public void setOverridable​(boolean overridable)
      • isDuplicated

        public boolean isDuplicated()
      • addDuplicate

        public void addDuplicate​(String duplicate)
      • getDuplicates

        public List<String> getDuplicates()
      • createAbsoluteOrdering

        public void createAbsoluteOrdering()
      • addAbsoluteOrdering

        public void addAbsoluteOrdering​(String fragmentName)
      • addAbsoluteOrderingOthers

        public void addAbsoluteOrderingOthers()
      • getAbsoluteOrdering

        public Set<String> getAbsoluteOrdering()
      • addAfterOrdering

        public void addAfterOrdering​(String fragmentName)
      • addAfterOrderingOthers

        public void addAfterOrderingOthers()
      • getAfterOrdering

        public Set<String> getAfterOrdering()
      • addBeforeOrdering

        public void addBeforeOrdering​(String fragmentName)
      • addBeforeOrderingOthers

        public void addBeforeOrderingOthers()
      • getBeforeOrdering

        public Set<String> getBeforeOrdering()
      • getVersion

        public String getVersion()
      • 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()
      • setPublicId

        public void setPublicId​(String publicId)
      • isMetadataComplete

        public boolean isMetadataComplete()
      • setMetadataComplete

        public void setMetadataComplete​(boolean metadataComplete)
      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • getMajorVersion

        public int getMajorVersion()
      • getMinorVersion

        public int getMinorVersion()
      • getDisplayName

        public String getDisplayName()
      • setDisplayName

        public void setDisplayName​(String displayName)
      • isDistributable

        public boolean isDistributable()
      • setDistributable

        public void setDistributable​(boolean distributable)
      • getDenyUncoveredHttpMethods

        public boolean getDenyUncoveredHttpMethods()
      • setDenyUncoveredHttpMethods

        public void setDenyUncoveredHttpMethods​(boolean denyUncoveredHttpMethods)
      • addContextParam

        public void addContextParam​(String param,
                                    String value)
      • addFilter

        public void addFilter​(FilterDef filter)
      • addFilterMapping

        public void addFilterMapping​(FilterMap filterMap)
      • getFilterMappings

        public Set<FilterMap> getFilterMappings()
      • addListener

        public void addListener​(String className)
      • getListeners

        public Set<String> getListeners()
      • addServlet

        public void addServlet​(ServletDef servletDef)
      • addServletMapping

        public void addServletMapping​(String urlPattern,
                                      String servletName)
      • addServletMappingDecoded

        public void addServletMappingDecoded​(String urlPattern,
                                             String servletName)
      • setSessionConfig

        public void setSessionConfig​(SessionConfig sessionConfig)
      • addMimeMapping

        public void addMimeMapping​(String extension,
                                   String mimeType)
      • setReplaceWelcomeFiles

        public void setReplaceWelcomeFiles​(boolean replaceWelcomeFiles)
        When merging/parsing web.xml files into this web.xml should the current set be completely replaced?
        Parameters:
        replaceWelcomeFiles - true to replace welcome files rather than add to the list
      • 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)
      • getWelcomeFiles

        public Set<String> getWelcomeFiles()
      • addErrorPage

        public void addErrorPage​(ErrorPage errorPage)
      • addTaglib

        public void addTaglib​(String uri,
                              String location)
      • addJspPropertyGroup

        public void addJspPropertyGroup​(JspPropertyGroup propertyGroup)
      • addSecurityConstraint

        public void addSecurityConstraint​(SecurityConstraint securityConstraint)
      • setLoginConfig

        public void setLoginConfig​(LoginConfig loginConfig)
      • addSecurityRole

        public void addSecurityRole​(String securityRole)
      • getSecurityRoles

        public Set<String> getSecurityRoles()
      • addEjbRef

        public void addEjbRef​(ContextEjb ejbRef)
      • addEjbLocalRef

        public void addEjbLocalRef​(ContextLocalEjb ejbLocalRef)
      • addServiceRef

        public void addServiceRef​(ContextService serviceRef)
      • addResourceRef

        public void addResourceRef​(ContextResource resourceRef)
      • addMessageDestinationRef

        public void addMessageDestinationRef​(MessageDestinationRef messageDestinationRef)
      • addMessageDestination

        public void addMessageDestination​(MessageDestination messageDestination)
      • addLocaleEncodingMapping

        public void addLocaleEncodingMapping​(String locale,
                                             String encoding)
      • getLocaleEncodingMappings

        public Map<String,​String> getLocaleEncodingMappings()
      • addPostConstructMethods

        public void addPostConstructMethods​(String clazz,
                                            String method)
      • getPostConstructMethods

        public Map<String,​String> getPostConstructMethods()
      • addPreDestroyMethods

        public void addPreDestroyMethods​(String clazz,
                                         String method)
      • getPreDestroyMethods

        public Map<String,​String> getPreDestroyMethods()
      • getRequestCharacterEncoding

        public String getRequestCharacterEncoding()
      • setRequestCharacterEncoding

        public void setRequestCharacterEncoding​(String requestCharacterEncoding)
      • getResponseCharacterEncoding

        public String getResponseCharacterEncoding()
      • setResponseCharacterEncoding

        public void setResponseCharacterEncoding​(String responseCharacterEncoding)
      • setURL

        public void setURL​(URL url)
      • getURL

        public URL getURL()
      • setJarName

        public void setJarName​(String jarName)
      • getJarName

        public String getJarName()
      • setWebappJar

        public void setWebappJar​(boolean webappJar)
      • getWebappJar

        public boolean getWebappJar()
      • getDelegate

        public boolean getDelegate()
      • setDelegate

        public void setDelegate​(boolean delegate)
      • 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