|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.cargo.module.AbstractDescriptor
org.codehaus.cargo.module.webapp.WebXml
public class 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 document)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addContextParam(org.w3c.dom.Element contextParam)
Adds a new context-param element to the descriptor. |
void |
addEjbRef(EjbRef ref)
Adds an ejb-ref. |
void |
addFilter(org.w3c.dom.Element filter)
Adds a new servlet filter to the descriptor. |
void |
addFilter(java.lang.String filterName,
java.lang.String filterClass)
Adds a new servlet filter to the descriptor. |
void |
addFilterInitParam(java.lang.String filterName,
java.lang.String paramName,
java.lang.String paramValue)
Adds an initialization parameter to the specified filter. |
void |
addFilterMapping(java.lang.String filterName,
java.lang.String urlPattern)
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 |
addRootElement(DescriptorTag tag,
org.w3c.dom.Element element)
Adds an element of the specified tag to root of 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. |
void |
addServletRunAsRoleName(java.lang.String theServletName,
java.lang.String theRoleName)
Adds a run-as declaration to the specified servlet. |
void |
addVendorDescriptor(VendorWebAppDescriptor descr)
Associates a vendor specific descriptor with this web.xml. |
org.w3c.dom.Element |
getContextParam(java.lang.String paramName)
Returns the element that contains the definition of a specific context param, or null if a context param of the specified name is not defined in the descriptor. |
java.lang.String |
getContextParamName(org.w3c.dom.Element contextParam)
|
AbstractNodeList |
getContextParams()
Get the context parameters. |
java.lang.String |
getFileName()
Returns the file name of this descriptor. |
org.w3c.dom.Element |
getFilter(java.lang.String filterName)
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 filterName,
java.lang.String paramName)
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 className)
Returns a list of names of filters that are mapped to the specified class. |
AbstractNodeList |
getListeners()
Returns a list of nodes that are of web listeners. |
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. |
java.lang.String |
getServletRunAsRoleName(java.lang.String theServletName)
Returns the role name that the servlet is running as. |
java.util.Iterator |
getVendorDescriptors()
Returns all vendor descriptors associated with this web.xml. |
WebXmlVersion |
getVersion()
Returns the servlet API version. |
boolean |
hasContextParam(java.lang.String theParamName)
Returns whether a context param by the specified name is defined in the deployment descriptor. |
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 |
replaceRootElement(DescriptorTag tag,
org.w3c.dom.Element element)
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 org.codehaus.cargo.module.AbstractDescriptor |
|---|
addElement, checkElement, createNestedText, getChildText, getDocument, getElements, getImmediateChild, getInsertionPointFor, getNestedElements, getNestedText, getRootElement, getText, replaceElement |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.codehaus.cargo.module.Descriptor |
|---|
getDocument |
| Constructor Detail |
|---|
public WebXml(org.w3c.dom.Document document)
document - The DOM document representing the parsed deployment descriptor| Method Detail |
|---|
public java.lang.String getFileName()
getFileName in interface DescriptorDescriptor.getFileName()public AbstractNodeList getContextParams()
public void addVendorDescriptor(VendorWebAppDescriptor descr)
descr - the vendor specific dexcriptor to associatepublic java.util.Iterator getVendorDescriptors()
getVendorDescriptors in interface J2eeDescriptorpublic final WebXmlVersion getVersion()
public final void addFilter(java.lang.String filterName,
java.lang.String filterClass)
filterName - The name of the filter to addfilterClass - The name of the class implementing the filterpublic final void addContextParam(org.w3c.dom.Element contextParam)
contextParam - The element representing the context-param definitionpublic final void addFilter(org.w3c.dom.Element filter)
filter - The element representing the filter definition
public final void addFilterInitParam(java.lang.String filterName,
java.lang.String paramName,
java.lang.String paramValue)
filterName - The name of the filterparamName - The name of the parameterparamValue - The parameter value
public final void addFilterMapping(java.lang.String filterName,
java.lang.String urlPattern)
filterName - The name of the filterurlPattern - The URL pattern the filter should be mapped topublic final org.w3c.dom.Element getFilter(java.lang.String filterName)
null if a filter of the specified name is not defined in the descriptor.
filterName - The name of the servlet filter
public final org.w3c.dom.Element getContextParam(java.lang.String paramName)
null if a context param of the specified name is not defined in the descriptor.
paramName - The context param name
public final java.lang.String getContextParamName(org.w3c.dom.Element contextParam)
contextParam - the context param element from which to extractthe name
public final java.util.Iterator getFilterNamesForClass(java.lang.String className)
className - The fully qualified name of the filter class
public final java.lang.String getFilterInitParam(java.lang.String filterName,
java.lang.String paramName)
filterName - The name of the servlet filterparamName - 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 hasContextParam(java.lang.String theParamName)
theParamName - The name of the context param
true if the context param is defined, false otherwisepublic final boolean hasFilter(java.lang.String theFilterName)
theFilterName - The name of the filter
true if the filter is defined, false otherwise
public 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 application
public 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 definition
public 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 value
public final void addServletRunAsRoleName(java.lang.String theServletName,
java.lang.String theRoleName)
theServletName - the name of the servlet to manipulatetheRoleName - the role name that the servlet should be running as
public 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.lang.String getServletRunAsRoleName(java.lang.String theServletName)
theServletName - The name of the servlet of which the role name 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 otherwise
public 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 otherwise
public final void addRootElement(DescriptorTag tag,
org.w3c.dom.Element element)
tag - The descriptor tagelement - The element to add
public final void replaceRootElement(DescriptorTag tag,
org.w3c.dom.Element element)
tag - The descriptor tagelement - The element to replace the current elements withpublic void addEjbRef(EjbRef ref)
ref - the ejb-refpublic AbstractNodeList getListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||