Servlet url element defines a url location to a resource external to this
web application.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor.getLocalizedContentDescriptors().hasMoreElements()) {
boolean oneFailed = false;
boolean foundIt = false;
// get the url's in this .war
for (Enumeration e = descriptor.getLocalizedContentDescriptors() ; e.hasMoreElements() ;) {
foundIt = false;
LocalizedContentDescriptorImpl urls = (LocalizedContentDescriptorImpl)e.nextElement();
String url = urls.getUrl();
if (url.length() > 0) {
foundIt = true;
} else {
foundIt = false;
}
if (foundIt) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"Servlet url [ {0} ] defines a url location to a resource external to this web application.",
new Object[] {url}));
} else {
if (!oneFailed) {
oneFailed = true;
}
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: Servlet url [ {0} ] does not define a url location to a resource external to this web application.",
new Object[] {url}));
}
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else {
result.setStatus(Result.PASSED);
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no url elements within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;