Class WebXml
java.lang.Object
org.apache.tomcat.util.descriptor.web.XmlEncodingBase
org.apache.tomcat.util.descriptor.web.WebXml
- All Implemented Interfaces:
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAbsoluteOrdering(String fragmentName) voidvoidaddAfterOrdering(String fragmentName) voidvoidaddBeforeOrdering(String fragmentName) voidvoidaddContextParam(String param, String value) voidaddDuplicate(String duplicate) voidaddEjbLocalRef(ContextLocalEjb ejbLocalRef) voidaddEjbRef(ContextEjb ejbRef) voidaddEnvEntry(ContextEnvironment envEntry) voidaddErrorPage(ErrorPage errorPage) voidvoidaddFilterMapping(FilterMap filterMap) voidaddJspPropertyGroup(JspPropertyGroup propertyGroup) voidaddListener(String className) voidaddLocaleEncodingMapping(String locale, String encoding) voidaddMessageDestination(MessageDestination messageDestination) voidaddMessageDestinationRef(MessageDestinationRef messageDestinationRef) voidaddMimeMapping(String extension, String mimeType) voidaddPostConstructMethods(String clazz, String method) voidaddPreDestroyMethods(String clazz, String method) voidaddResourceEnvRef(ContextResourceEnvRef resourceEnvRef) voidaddResourceRef(ContextResource resourceRef) voidaddSecurityConstraint(SecurityConstraint securityConstraint) voidaddSecurityRole(String securityRole) voidaddServiceRef(ContextService serviceRef) voidaddServlet(ServletDef servletDef) voidaddServletMapping(String urlPattern, String servletName) voidaddServletMappingDecoded(String urlPattern, String servletName) voidvoidaddWelcomeFile(String welcomeFile) voidbooleanbooleanintintgetName()getURL()booleanbooleanbooleanbooleanbooleanbooleanMerge the supplied web fragments into this main web.xml.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.voidsetAlwaysAddWelcomeFiles(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.voidsetDelegate(boolean delegate) voidsetDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods) voidsetDisplayName(String displayName) voidsetDistributable(boolean distributable) voidsetJarName(String jarName) voidsetLoginConfig(LoginConfig loginConfig) voidsetMetadataComplete(boolean metadataComplete) voidvoidsetOverridable(boolean overridable) voidsetPublicId(String publicId) voidsetReplaceWelcomeFiles(boolean replaceWelcomeFiles) When merging/parsing web.xml files into this web.xml should the current set be completely replaced?voidsetRequestCharacterEncoding(String requestCharacterEncoding) voidsetResponseCharacterEncoding(String responseCharacterEncoding) voidsetSessionConfig(SessionConfig sessionConfig) voidvoidsetVersion(String version) Set the version for this web.xml filevoidsetWebappJar(boolean webappJar) toString()toXml()Generate a web.xml in String form that matches the representation stored in this object.Methods inherited from class org.apache.tomcat.util.descriptor.web.XmlEncodingBase
getCharset, setCharsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.tomcat.util.digester.DocumentProperties.Charset
setCharset
-
Field Details
-
ORDER_OTHERS
- See Also:
-
-
Constructor Details
-
WebXml
public WebXml()
-
-
Method Details
-
isOverridable
public boolean isOverridable() -
setOverridable
public void setOverridable(boolean overridable) -
isDuplicated
public boolean isDuplicated() -
addDuplicate
-
getDuplicates
-
createAbsoluteOrdering
public void createAbsoluteOrdering() -
addAbsoluteOrdering
-
addAbsoluteOrderingOthers
public void addAbsoluteOrderingOthers() -
getAbsoluteOrdering
-
addAfterOrdering
-
addAfterOrderingOthers
public void addAfterOrderingOthers() -
getAfterOrdering
-
addBeforeOrdering
-
addBeforeOrderingOthers
public void addBeforeOrderingOthers() -
getBeforeOrdering
-
getVersion
-
setVersion
Set the version for this web.xml file- Parameters:
version- Values ofnullwill be ignored
-
getPublicId
-
setPublicId
-
isMetadataComplete
public boolean isMetadataComplete() -
setMetadataComplete
public void setMetadataComplete(boolean metadataComplete) -
getName
-
setName
-
getMajorVersion
public int getMajorVersion() -
getMinorVersion
public int getMinorVersion() -
getDisplayName
-
setDisplayName
-
isDistributable
public boolean isDistributable() -
setDistributable
public void setDistributable(boolean distributable) -
getDenyUncoveredHttpMethods
public boolean getDenyUncoveredHttpMethods() -
setDenyUncoveredHttpMethods
public void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods) -
addContextParam
-
getContextParams
-
addFilter
-
getFilters
-
addFilterMapping
-
getFilterMappings
-
addListener
-
getListeners
-
addServlet
-
getServlets
-
addServletMapping
-
addServletMappingDecoded
-
getServletMappings
-
setSessionConfig
-
getSessionConfig
-
addMimeMapping
-
getMimeMappings
-
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-trueto 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-trueto add welcome files
-
addWelcomeFile
-
getWelcomeFiles
-
addErrorPage
-
getErrorPages
-
addTaglib
-
getTaglibs
-
addJspPropertyGroup
-
getJspPropertyGroups
-
addSecurityConstraint
-
getSecurityConstraints
-
setLoginConfig
-
getLoginConfig
-
addSecurityRole
-
getSecurityRoles
-
addEnvEntry
-
getEnvEntries
-
addEjbRef
-
getEjbRefs
-
addEjbLocalRef
-
getEjbLocalRefs
-
addServiceRef
-
getServiceRefs
-
addResourceRef
-
getResourceRefs
-
addResourceEnvRef
-
getResourceEnvRefs
-
addMessageDestinationRef
-
getMessageDestinationRefs
-
addMessageDestination
-
getMessageDestinations
-
addLocaleEncodingMapping
-
getLocaleEncodingMappings
-
addPostConstructMethods
-
getPostConstructMethods
-
addPreDestroyMethods
-
getPreDestroyMethods
-
getJspConfigDescriptor
-
getRequestCharacterEncoding
-
setRequestCharacterEncoding
-
getResponseCharacterEncoding
-
setResponseCharacterEncoding
-
setURL
-
getURL
-
setJarName
-
getJarName
-
setWebappJar
public void setWebappJar(boolean webappJar) -
getWebappJar
public boolean getWebappJar() -
getDelegate
public boolean getDelegate() -
setDelegate
public void setDelegate(boolean delegate) -
toString
-
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
-
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 filefragments- The map of fragment names to web fragmentsservletContext- The servlet context the fragments are associated with- Returns:
- Ordered list of web-fragment.xml files to process
-