|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cactus.integration.ant.deployment.WebXml
Encapsulates the DOM representation of a web deployment descriptor
web.xml
to provide convenience methods for easy access and
manipulation.
Constructor Summary | |
WebXml(org.w3c.dom.Document theDocument)
Constructor. |
Method Summary | |
void |
addElement(WebXmlTag theTag,
org.w3c.dom.Element theElement)
Adds an element of the specified tag to the descriptor. |
void |
addFilter(org.w3c.dom.Element theFilter)
Adds a new servlet filter to the descriptor. |
void |
addFilter(java.lang.String theFilterName,
java.lang.String theFilterClass)
Adds a new servlet filter to the descriptor. |
void |
addFilterInitParam(java.lang.String theFilterName,
java.lang.String theParamName,
java.lang.String theParamValue)
Adds an initialization parameter to the specified filter. |
void |
addFilterMapping(java.lang.String theFilterName,
java.lang.String theUrlPattern)
Adds a filter mapping to the descriptor. |
void |
addJspFile(java.lang.String theServletName,
java.lang.String theJspFile)
Adds a mapped JSP file to the descriptor. |
void |
addSecurityConstraint(java.lang.String theWebResourceName,
java.lang.String theUrlPattern,
java.util.List theRoles)
Creates and adds a security-constraint to the descriptor. |
void |
addSecurityRole(java.lang.String theRoleName)
Adds a new security role to the descriptor. |
void |
addServlet(org.w3c.dom.Element theServlet)
Adds a new servlet to the descriptor. |
void |
addServlet(java.lang.String theServletName,
java.lang.String theServletClass)
Adds a new servlet to the descriptor. |
void |
addServletInitParam(java.lang.String theServletName,
java.lang.String theParamName,
java.lang.String theParamValue)
Adds an initialization parameter to the specified servlet. |
void |
addServletMapping(java.lang.String theServletName,
java.lang.String theUrlPattern)
Adds a servlet mapping to the descriptor. |
org.w3c.dom.Document |
getDocument()
Returns the DOM document representing the deployment descriptor. |
java.util.Iterator |
getElements(WebXmlTag theTag)
Returns an iterator over the elements that match the specified tag. |
org.w3c.dom.Element |
getFilter(java.lang.String theFilterName)
Returns the element that contains the definition of a specific servlet filter, or null if a filter of the specified name is not
defined in the descriptor. |
java.lang.String |
getFilterInitParam(java.lang.String theFilterName,
java.lang.String theParamName)
Returns the value of an initialization parameter of the specified filter. |
java.util.Iterator |
getFilterInitParamNames(java.lang.String theFilterName)
Returns the names of the initialization parameters of the specified servlet filter. |
java.util.Iterator |
getFilterMappings(java.lang.String theFilterName)
Returns the URL-patterns that the specified filter is mapped to in an ordered list. |
java.util.Iterator |
getFilterNames()
Returns the names of all filters defined in the deployment descriptor. |
java.util.Iterator |
getFilterNamesForClass(java.lang.String theClassName)
Returns a list of names of filters that are mapped to the specified class. |
org.w3c.dom.Element |
getLoginConfig()
Returns whether the descriptor has a login configuration. |
java.lang.String |
getLoginConfigAuthMethod()
Returns the authorization method defined by the login configuration. |
org.w3c.dom.Element |
getSecurityConstraint(java.lang.String theUrlPattern)
Returns the element that contains the security constraint defined for the specified URL pattern. |
org.w3c.dom.Element |
getSecurityRole(java.lang.String theRoleName)
Returns the element that contains the specified security role, or null if the role is not defined in the descriptor. |
java.util.Iterator |
getSecurityRoleNames()
Returns a list of the security role names defined in the deployment descriptor |
org.w3c.dom.Element |
getServlet(java.lang.String theServletName)
Returns the element that contains the definition of a specific servlet, or null if a servlet of the specified name is not defined
in the descriptor. |
java.lang.String |
getServletInitParam(java.lang.String theServletName,
java.lang.String theParamName)
Returns the value of an initialization parameter of the specified servlet. |
java.util.Iterator |
getServletInitParamNames(java.lang.String theServletName)
Returns the names of the initialization parameters of the specified servlet. |
java.util.Iterator |
getServletMappings(java.lang.String theServletName)
Returns the URL-patterns that the specified servlet is mapped to in an ordered list. |
java.util.Iterator |
getServletNames()
Returns the names of all servlets defined in the deployment descriptor. |
java.util.Iterator |
getServletNamesForClass(java.lang.String theClassName)
Returns a list of names of servlets that are mapped to the specified class. |
java.util.Iterator |
getServletNamesForJspFile(java.lang.String theJspFile)
Returns a list of names of servlets that are mapped to the specified JSP file. |
WebXmlVersion |
getVersion()
Returns the servlet API version. |
boolean |
hasFilter(java.lang.String theFilterName)
Returns whether a servlet filter by the specified name is defined in the deployment descriptor. |
boolean |
hasLoginConfig()
Returns whether the descriptor has a login configuration. |
boolean |
hasSecurityConstraint(java.lang.String theUrlPattern)
Returns whether a security constraint has been mapped to the specified URL pattern. |
boolean |
hasSecurityRole(java.lang.String theRoleName)
Returns whether a specific security role has been defined. |
boolean |
hasServlet(java.lang.String theServletName)
Returns whether a servlet by the specified name is defined in the deployment descriptor. |
void |
replaceElement(WebXmlTag theTag,
org.w3c.dom.Element theElement)
Replaces all elements of the specified tag with the provided element. |
void |
setLoginConfig(java.lang.String theAuthMethod,
java.lang.String theRealmName)
Sets the login configuration. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WebXml(org.w3c.dom.Document theDocument)
theDocument
- The DOM document representing the parsed deployment
descriptorMethod Detail |
public final org.w3c.dom.Document getDocument()
public final WebXmlVersion getVersion()
public final void addFilter(java.lang.String theFilterName, java.lang.String theFilterClass)
theFilterName
- The name of the filter to addtheFilterClass
- The name of the class implementing the filterpublic final void addFilter(org.w3c.dom.Element theFilter)
theFilter
- The element representing the filter definitionpublic final void addFilterInitParam(java.lang.String theFilterName, java.lang.String theParamName, java.lang.String theParamValue)
theFilterName
- The name of the filtertheParamName
- The name of the parametertheParamValue
- The parameter valuepublic final void addFilterMapping(java.lang.String theFilterName, java.lang.String theUrlPattern)
theFilterName
- The name of the filtertheUrlPattern
- The URL pattern the filter should be mapped topublic final org.w3c.dom.Element getFilter(java.lang.String theFilterName)
null
if a filter of the specified name is not
defined in the descriptor.
theFilterName
- The name of the servlet filter
public final java.util.Iterator getFilterNamesForClass(java.lang.String theClassName)
theClassName
- The fully qualified name of the filter class
public final java.lang.String getFilterInitParam(java.lang.String theFilterName, java.lang.String theParamName)
theFilterName
- The name of the servlet filtertheParamName
- The name of the initialization parameter
public final java.util.Iterator getFilterInitParamNames(java.lang.String theFilterName)
theFilterName
- The name of the servlet filter of which the
parameter names should be retrieved
public final java.util.Iterator getFilterMappings(java.lang.String theFilterName)
theFilterName
- The name of the servlet filter of which the
mappings should be retrieved
public final java.util.Iterator getFilterNames()
public final boolean hasFilter(java.lang.String theFilterName)
theFilterName
- The name of the filter
true
if the filter is defined, false
otherwisepublic final void addJspFile(java.lang.String theServletName, java.lang.String theJspFile)
theServletName
- The name of the servlet to addtheJspFile
- The path to the JSP file relative to the root of the
web applicationpublic final void addServlet(java.lang.String theServletName, java.lang.String theServletClass)
theServletName
- The name of the servlet to addtheServletClass
- The name of the class implementing the servletpublic final void addServlet(org.w3c.dom.Element theServlet)
theServlet
- The element representing the servlet definitionpublic final void addServletInitParam(java.lang.String theServletName, java.lang.String theParamName, java.lang.String theParamValue)
theServletName
- The name of the filtertheParamName
- The name of the parametertheParamValue
- The parameter valuepublic final void addServletMapping(java.lang.String theServletName, java.lang.String theUrlPattern)
theServletName
- The name of the servlettheUrlPattern
- The URL pattern the servlet should be mapped topublic final org.w3c.dom.Element getServlet(java.lang.String theServletName)
null
if a servlet of the specified name is not defined
in the descriptor.
theServletName
- The name of the servlet
public final java.lang.String getServletInitParam(java.lang.String theServletName, java.lang.String theParamName)
theServletName
- The name of the servlettheParamName
- The name of the initialization parameter
public final java.util.Iterator getServletInitParamNames(java.lang.String theServletName)
theServletName
- The name of the servlet of which the parameter
names should be retrieved
public final java.util.Iterator getServletMappings(java.lang.String theServletName)
theServletName
- The name of the servlet of which the mappings
should be retrieved
public final java.util.Iterator getServletNames()
public final java.util.Iterator getServletNamesForClass(java.lang.String theClassName)
theClassName
- The fully qualified name of the servlet class
public final java.util.Iterator getServletNamesForJspFile(java.lang.String theJspFile)
theJspFile
- The path to the JSP file, relative to the root of the
web-application
public final boolean hasServlet(java.lang.String theServletName)
theServletName
- The name of the servlet
true
if the servlet is defined, false
otherwisepublic final void addSecurityConstraint(java.lang.String theWebResourceName, java.lang.String theUrlPattern, java.util.List theRoles)
theWebResourceName
- The name of the web resource collection to
protecttheUrlPattern
- The URL pattern to apply the constraint totheRoles
- The list of authorized rolespublic final org.w3c.dom.Element getSecurityConstraint(java.lang.String theUrlPattern)
theUrlPattern
- The URL pattern
public final boolean hasSecurityConstraint(java.lang.String theUrlPattern)
theUrlPattern
- The URL patterm
true
if a security constraint is defined,
false
otherwisepublic final boolean hasLoginConfig()
true
if a login config is defined,
false
otherwisepublic final org.w3c.dom.Element getLoginConfig()
true
if a login config is defined,
false
otherwisepublic final java.lang.String getLoginConfigAuthMethod()
public final void setLoginConfig(java.lang.String theAuthMethod, java.lang.String theRealmName)
theAuthMethod
- The authentication method (for example, BASIC)theRealmName
- The name of the realmpublic final void addSecurityRole(java.lang.String theRoleName)
theRoleName
- The name of the role to addpublic final org.w3c.dom.Element getSecurityRole(java.lang.String theRoleName)
null
if the role is not defined in the descriptor.
theRoleName
- The name of the role
public final java.util.Iterator getSecurityRoleNames()
public final boolean hasSecurityRole(java.lang.String theRoleName)
theRoleName
- The name of the role
true
if the security role is defined,
false
otherwisepublic final java.util.Iterator getElements(WebXmlTag theTag)
theTag
- The descriptor tag of which the elements should be
returned
public final void addElement(WebXmlTag theTag, org.w3c.dom.Element theElement)
theTag
- The descriptor tagtheElement
- The element to addpublic final void replaceElement(WebXmlTag theTag, org.w3c.dom.Element theElement)
theTag
- The descriptor tagtheElement
- The element to replace the current elements with
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |