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 (eg single login-config)
This class checks for invalid duplicates (eg filter/servlet names)
StandardContext will check validity of values (eg URL formats etc)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAbsoluteOrdering
(String fragmentName) void
void
addAfterOrdering
(String fragmentName) void
void
addBeforeOrdering
(String fragmentName) void
void
addContextParam
(String param, String value) void
addDuplicate
(String duplicate) void
addEjbLocalRef
(ContextLocalEjb ejbLocalRef) void
addEjbRef
(ContextEjb ejbRef) void
addEnvEntry
(ContextEnvironment envEntry) void
addErrorPage
(ErrorPage errorPage) void
void
addFilterMapping
(FilterMap filterMap) void
addJspPropertyGroup
(JspPropertyGroup propertyGroup) void
addListener
(String className) void
addLocaleEncodingMapping
(String locale, String encoding) void
addMessageDestination
(MessageDestination messageDestination) void
addMessageDestinationRef
(MessageDestinationRef messageDestinationRef) void
addMimeMapping
(String extension, String mimeType) void
addPostConstructMethods
(String clazz, String method) void
addPreDestroyMethods
(String clazz, String method) void
addResourceEnvRef
(ContextResourceEnvRef resourceEnvRef) void
addResourceRef
(ContextResource resourceRef) void
addSecurityConstraint
(SecurityConstraint securityConstraint) void
addSecurityRole
(String securityRole) void
addServiceRef
(ContextService serviceRef) void
addServlet
(ServletDef servletDef) void
addServletMapping
(String urlPattern, String servletName) void
addServletMappingDecoded
(String urlPattern, String servletName) void
void
addWelcomeFile
(String welcomeFile) void
boolean
boolean
int
int
getName()
getURL()
boolean
boolean
boolean
boolean
boolean
boolean
Merge 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.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) void
setDenyUncoveredHttpMethods
(boolean denyUncoveredHttpMethods) void
setDisplayName
(String displayName) void
setDistributable
(boolean distributable) void
setDuplicated
(boolean duplicated) Deprecated.void
setJarName
(String jarName) void
setLoginConfig
(LoginConfig loginConfig) void
setMetadataComplete
(boolean metadataComplete) void
void
setOverridable
(boolean overridable) void
setPublicId
(String publicId) void
setReplaceWelcomeFiles
(boolean replaceWelcomeFiles) When merging/parsing web.xml files into this web.xml should the current set be completely replaced?void
setRequestCharacterEncoding
(String requestCharacterEncoding) void
setResponseCharacterEncoding
(String responseCharacterEncoding) void
setSessionConfig
(SessionConfig sessionConfig) void
void
setVersion
(String version) Set the version for this web.xml filevoid
setWebappJar
(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, setCharset
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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() -
setDuplicated
Deprecated. -
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 ofnull
will 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
-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
-
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
Merge the supplied web fragments into this main web.xml.- Parameters:
fragments
- The fragments to merge in- Returns:
true
if merge is successful, elsefalse
-
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
-