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 java.lang.StringORDER_OTHERSMarker for "others" in ordering.
-
Constructor Summary
Constructors Constructor Description WebXml()Constructs a new WebXml.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAbsoluteOrdering(java.lang.String fragmentName)Adds a fragment name to the absolute ordering.voidaddAbsoluteOrderingOthers()Adds "others" to the absolute ordering.voidaddAfterOrdering(java.lang.String fragmentName)Adds a fragment name to the after ordering.voidaddAfterOrderingOthers()Adds "others" to the after ordering.voidaddBeforeOrdering(java.lang.String fragmentName)Adds a fragment name to the before ordering.voidaddBeforeOrderingOthers()Adds "others" to the before ordering.voidaddContextParam(java.lang.String param, java.lang.String value)Adds a context parameter.voidaddDuplicate(java.lang.String duplicate)Adds a duplicate fragment name.voidaddEjbLocalRef(ContextLocalEjb ejbLocalRef)Adds an EJB local reference.voidaddEjbRef(ContextEjb ejbRef)Adds an EJB reference.voidaddEnvEntry(ContextEnvironment envEntry)Adds an environment entry.voidaddErrorPage(ErrorPage errorPage)Adds an error page.voidaddFilter(FilterDef filter)Adds a filter definition.voidaddFilterMapping(FilterMap filterMap)Adds a filter mapping.voidaddJspPropertyGroup(JspPropertyGroup propertyGroup)Adds a JSP property group.voidaddListener(java.lang.String className)Adds a listener class.voidaddLocaleEncodingMapping(java.lang.String locale, java.lang.String encoding)Adds a locale-encoding mapping.voidaddMessageDestination(MessageDestination messageDestination)Adds a message destination.voidaddMessageDestinationRef(MessageDestinationRef messageDestinationRef)Adds a message destination reference.voidaddMimeMapping(java.lang.String extension, java.lang.String mimeType)Adds a MIME mapping.voidaddPostConstructMethods(java.lang.String clazz, java.lang.String method)Adds a post-construct method.voidaddPreDestroyMethods(java.lang.String clazz, java.lang.String method)Adds a pre-destroy method.voidaddResourceEnvRef(ContextResourceEnvRef resourceEnvRef)Adds a resource environment reference.voidaddResourceRef(ContextResource resourceRef)Adds a resource reference.voidaddSecurityConstraint(SecurityConstraint securityConstraint)Adds a security constraint.voidaddSecurityRole(java.lang.String securityRole)Adds a security role.voidaddServiceRef(ContextService serviceRef)Adds a service reference.voidaddServlet(ServletDef servletDef)Adds a servlet definition.voidaddServletMapping(java.lang.String urlPattern, java.lang.String servletName)Adds a servlet URL mapping.voidaddServletMappingDecoded(java.lang.String urlPattern, java.lang.String servletName)Adds a servlet URL mapping (already decoded).voidaddTaglib(java.lang.String uri, java.lang.String location)Adds a taglib mapping.voidaddWelcomeFile(java.lang.String welcomeFile)Adds a welcome file.voidcreateAbsoluteOrdering()Initializes the absolute ordering set if it has not been created yet.java.util.Set<java.lang.String>getAbsoluteOrdering()Returns the absolute ordering set.java.util.Set<java.lang.String>getAfterOrdering()Returns the after ordering set.java.util.Set<java.lang.String>getBeforeOrdering()Returns the before ordering set.java.util.Map<java.lang.String,java.lang.String>getContextParams()Returns the context parameters.booleangetDelegate()Returns whether this web application delegates first for class loading.booleangetDenyUncoveredHttpMethods()Returns whether uncovered HTTP methods are denied.java.lang.StringgetDisplayName()Returns the display name of the web application.java.util.List<java.lang.String>getDuplicates()Returns the list of duplicate fragment names.java.util.Map<java.lang.String,ContextLocalEjb>getEjbLocalRefs()Returns the EJB local references.java.util.Map<java.lang.String,ContextEjb>getEjbRefs()Returns the EJB references.java.util.Map<java.lang.String,ContextEnvironment>getEnvEntries()Returns the environment entries.java.util.Map<java.lang.String,ErrorPage>getErrorPages()Returns the error pages.java.util.Set<FilterMap>getFilterMappings()Returns the filter mappings.java.util.Map<java.lang.String,FilterDef>getFilters()Returns the filter definitions.java.lang.StringgetJarName()Returns the JAR name for this web fragment.JspConfigDescriptorgetJspConfigDescriptor()Returns the JSP configuration descriptor.java.util.Set<JspPropertyGroup>getJspPropertyGroups()Returns the JSP property groups.java.util.Set<java.lang.String>getListeners()Returns the listener class names.java.util.Map<java.lang.String,java.lang.String>getLocaleEncodingMappings()Returns the locale-encoding mappings.LoginConfiggetLoginConfig()Returns the login configuration.intgetMajorVersion()Returns the major version number.java.util.Map<java.lang.String,MessageDestinationRef>getMessageDestinationRefs()Returns the message destination references.java.util.Map<java.lang.String,MessageDestination>getMessageDestinations()Returns the message destinations.java.util.Map<java.lang.String,java.lang.String>getMimeMappings()Returns the MIME mappings.intgetMinorVersion()Returns the minor version number.java.lang.StringgetName()Returns the name of the web application.java.util.Map<java.lang.String,java.lang.String>getPostConstructMethods()Returns the post-construct methods.java.util.Map<java.lang.String,java.lang.String>getPreDestroyMethods()Returns the pre-destroy methods.java.lang.StringgetPublicId()Returns the public identifier.java.lang.StringgetRequestCharacterEncoding()Returns the request character encoding.java.util.Map<java.lang.String,ContextResourceEnvRef>getResourceEnvRefs()Returns the resource environment references.java.util.Map<java.lang.String,ContextResource>getResourceRefs()Returns the resource references.java.lang.StringgetResponseCharacterEncoding()Returns the response character encoding.java.util.Set<SecurityConstraint>getSecurityConstraints()Returns the security constraints.java.util.Set<java.lang.String>getSecurityRoles()Returns the security roles.java.util.Map<java.lang.String,ContextService>getServiceRefs()Returns the service references.java.util.Map<java.lang.String,java.lang.String>getServletMappings()Returns the servlet URL mappings.java.util.Map<java.lang.String,ServletDef>getServlets()Returns the servlet definitions.SessionConfiggetSessionConfig()Returns the session configuration.java.util.Map<java.lang.String,java.lang.String>getTaglibs()Returns the taglib mappings.java.net.URLgetURL()Returns the URL of the web.xml.java.lang.StringgetVersion()Returns the version of the web.xml.booleangetWebappJar()Returns whether this descriptor came from a webapp JAR.java.util.Set<java.lang.String>getWelcomeFiles()Returns the welcome files.booleanisDistributable()Returns whether the web application is distributable.booleanisDuplicated()Returns whether this web fragment has duplicate entries.booleanisMetadataComplete()Returns whether metadata is complete.booleanisOverridable()Returns whether this web fragment is overridable.booleanmerge(java.util.Set<WebXml> fragments)Merge the supplied web fragments into this main web.xml.static java.util.Set<WebXml>orderWebFragments(WebXml application, java.util.Map<java.lang.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)Sets whether this web application delegates first for class loading.voidsetDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)Sets whether uncovered HTTP methods are denied.voidsetDisplayName(java.lang.String displayName)Sets the display name.voidsetDistributable(boolean distributable)Sets whether the web application is distributable.voidsetJarName(java.lang.String jarName)Sets the JAR name for this web fragment.voidsetLoginConfig(LoginConfig loginConfig)Sets the login configuration.voidsetMetadataComplete(boolean metadataComplete)Sets whether metadata is complete.voidsetName(java.lang.String name)Sets the name of the web application.voidsetOverridable(boolean overridable)Sets whether this web fragment is overridable.voidsetPublicId(java.lang.String publicId)Sets the public identifier.voidsetReplaceWelcomeFiles(boolean replaceWelcomeFiles)Sets whether welcome files should replace existing ones.voidsetRequestCharacterEncoding(java.lang.String requestCharacterEncoding)Sets the request character encoding.voidsetResponseCharacterEncoding(java.lang.String responseCharacterEncoding)Sets the response character encoding.voidsetSessionConfig(SessionConfig sessionConfig)Sets the session configuration.voidsetURL(java.net.URL url)Sets the URL of the web.xml.voidsetVersion(java.lang.String version)Set the version for this web.xml filevoidsetWebappJar(boolean webappJar)Sets whether this descriptor came from a webapp JAR.java.lang.StringtoString()java.lang.StringtoXml()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 Detail
-
ORDER_OTHERS
protected static final java.lang.String ORDER_OTHERS
Marker for "others" in ordering.- See Also:
- Constant Field Values
-
-
Method Detail
-
isOverridable
public boolean isOverridable()
Returns whether this web fragment is overridable.- Returns:
trueif 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:
trueif duplicates exist
-
addDuplicate
public void addDuplicate(java.lang.String duplicate)
Adds a duplicate fragment name.- Parameters:
duplicate- The duplicate fragment name
-
getDuplicates
public java.util.List<java.lang.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(java.lang.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 java.util.Set<java.lang.String> getAbsoluteOrdering()
Returns the absolute ordering set.- Returns:
- the absolute ordering
-
addAfterOrdering
public void addAfterOrdering(java.lang.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:
java.lang.IllegalArgumentException- If "others" is already in the before ordering
-
getAfterOrdering
public java.util.Set<java.lang.String> getAfterOrdering()
Returns the after ordering set.- Returns:
- the after ordering
-
addBeforeOrdering
public void addBeforeOrdering(java.lang.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:
java.lang.IllegalArgumentException- If "others" is already in the after ordering
-
getBeforeOrdering
public java.util.Set<java.lang.String> getBeforeOrdering()
Returns the before ordering set.- Returns:
- the before ordering
-
getVersion
public java.lang.String getVersion()
Returns the version of the web.xml.- Returns:
- the version
-
setVersion
public void setVersion(java.lang.String version)
Set the version for this web.xml file- Parameters:
version- Values ofnullwill be ignored
-
getPublicId
public java.lang.String getPublicId()
Returns the public identifier.- Returns:
- the public identifier
-
setPublicId
public void setPublicId(java.lang.String publicId)
Sets the public identifier.- Parameters:
publicId- The public identifier
-
isMetadataComplete
public boolean isMetadataComplete()
Returns whether metadata is complete.- Returns:
trueif metadata is complete
-
setMetadataComplete
public void setMetadataComplete(boolean metadataComplete)
Sets whether metadata is complete.- Parameters:
metadataComplete- The metadata complete flag
-
getName
public java.lang.String getName()
Returns the name of the web application.- Returns:
- the name
-
setName
public void setName(java.lang.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 java.lang.String getDisplayName()
Returns the display name of the web application.- Returns:
- the display name
-
setDisplayName
public void setDisplayName(java.lang.String displayName)
Sets the display name.- Parameters:
displayName- The display name
-
isDistributable
public boolean isDistributable()
Returns whether the web application is distributable.- Returns:
trueif 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:
trueif 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(java.lang.String param, java.lang.String value)Adds a context parameter.- Parameters:
param- The parameter namevalue- The parameter value
-
getContextParams
public java.util.Map<java.lang.String,java.lang.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:
java.lang.IllegalArgumentException- If a filter with the same name already exists
-
getFilters
public java.util.Map<java.lang.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 java.util.Set<FilterMap> getFilterMappings()
Returns the filter mappings.- Returns:
- the filter mappings
-
addListener
public void addListener(java.lang.String className)
Adds a listener class.- Parameters:
className- The listener class name
-
getListeners
public java.util.Set<java.lang.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 java.util.Map<java.lang.String,ServletDef> getServlets()
Returns the servlet definitions.- Returns:
- the servlet definitions
-
addServletMapping
public void addServletMapping(java.lang.String urlPattern, java.lang.String servletName)Adds a servlet URL mapping.- Parameters:
urlPattern- The URL patternservletName- The servlet name
-
addServletMappingDecoded
public void addServletMappingDecoded(java.lang.String urlPattern, java.lang.String servletName)Adds a servlet URL mapping (already decoded).- Parameters:
urlPattern- The URL patternservletName- The servlet name- Throws:
java.lang.IllegalArgumentException- If a duplicate mapping exists
-
getServletMappings
public java.util.Map<java.lang.String,java.lang.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(java.lang.String extension, java.lang.String mimeType)Adds a MIME mapping.- Parameters:
extension- The file extensionmimeType- The MIME type
-
getMimeMappings
public java.util.Map<java.lang.String,java.lang.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-trueto add welcome files
-
addWelcomeFile
public void addWelcomeFile(java.lang.String welcomeFile)
Adds a welcome file.- Parameters:
welcomeFile- The welcome file name
-
getWelcomeFiles
public java.util.Set<java.lang.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 java.util.Map<java.lang.String,ErrorPage> getErrorPages()
Returns the error pages.- Returns:
- the error pages
-
addTaglib
public void addTaglib(java.lang.String uri, java.lang.String location)Adds a taglib mapping.- Parameters:
uri- The taglib URIlocation- The taglib location
-
getTaglibs
public java.util.Map<java.lang.String,java.lang.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 java.util.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 java.util.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(java.lang.String securityRole)
Adds a security role.- Parameters:
securityRole- The security role name
-
getSecurityRoles
public java.util.Set<java.lang.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:
java.lang.IllegalArgumentException- If an entry with the same name already exists
-
getEnvEntries
public java.util.Map<java.lang.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 java.util.Map<java.lang.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 java.util.Map<java.lang.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 java.util.Map<java.lang.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:
java.lang.IllegalArgumentException- If a reference with the same name already exists
-
getResourceRefs
public java.util.Map<java.lang.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:
java.lang.IllegalArgumentException- If a reference with the same name already exists
-
getResourceEnvRefs
public java.util.Map<java.lang.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:
java.lang.IllegalArgumentException- If a reference with the same name already exists
-
getMessageDestinationRefs
public java.util.Map<java.lang.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:
java.lang.IllegalArgumentException- If a destination with the same name already exists
-
getMessageDestinations
public java.util.Map<java.lang.String,MessageDestination> getMessageDestinations()
Returns the message destinations.- Returns:
- the message destinations
-
addLocaleEncodingMapping
public void addLocaleEncodingMapping(java.lang.String locale, java.lang.String encoding)Adds a locale-encoding mapping.- Parameters:
locale- The localeencoding- The encoding
-
getLocaleEncodingMappings
public java.util.Map<java.lang.String,java.lang.String> getLocaleEncodingMappings()
Returns the locale-encoding mappings.- Returns:
- the locale-encoding mappings
-
addPostConstructMethods
public void addPostConstructMethods(java.lang.String clazz, java.lang.String method)Adds a post-construct method.- Parameters:
clazz- The class namemethod- The method name
-
getPostConstructMethods
public java.util.Map<java.lang.String,java.lang.String> getPostConstructMethods()
Returns the post-construct methods.- Returns:
- the post-construct methods
-
addPreDestroyMethods
public void addPreDestroyMethods(java.lang.String clazz, java.lang.String method)Adds a pre-destroy method.- Parameters:
clazz- The class namemethod- The method name
-
getPreDestroyMethods
public java.util.Map<java.lang.String,java.lang.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 java.lang.String getRequestCharacterEncoding()
Returns the request character encoding.- Returns:
- the request character encoding
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(java.lang.String requestCharacterEncoding)
Sets the request character encoding.- Parameters:
requestCharacterEncoding- The request character encoding
-
getResponseCharacterEncoding
public java.lang.String getResponseCharacterEncoding()
Returns the response character encoding.- Returns:
- the response character encoding
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(java.lang.String responseCharacterEncoding)
Sets the response character encoding.- Parameters:
responseCharacterEncoding- The response character encoding
-
setURL
public void setURL(java.net.URL url)
Sets the URL of the web.xml.- Parameters:
url- The URL
-
getURL
public java.net.URL getURL()
Returns the URL of the web.xml.- Returns:
- the URL
-
setJarName
public void setJarName(java.lang.String jarName)
Sets the JAR name for this web fragment.- Parameters:
jarName- The JAR name
-
getJarName
public java.lang.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:
trueif from a webapp JAR
-
getDelegate
public boolean getDelegate()
Returns whether this web application delegates first for class loading.- Returns:
trueif 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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toXml
public java.lang.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(java.util.Set<WebXml> fragments)
Merge the supplied web fragments into this main web.xml.- Parameters:
fragments- The fragments to merge in- Returns:
trueif merge is successful, elsefalse
-
orderWebFragments
public static java.util.Set<WebXml> orderWebFragments(WebXml application, java.util.Map<java.lang.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
-
-