FilterBase.java revision 56443cf7fbca96bc184ca8d386c3f7fc6f947f42
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: FilterBase.java,v 1.2 2008/11/28 12:36:21 saueree Exp $
*/
boolean result = true;
try {
if (!isAgentFilterPresent(xmldoc)) {
index);
index + 1);
}
"FilterBase.addFilterElement(): "
+ "Exception caught while adding <filter> to the " +
"global web.xml file: "
+ ex.getMessage(),
ex);
result = false;
}
return result;
}
throws Exception {
boolean filterFound = false;
// already contains the agent filter, so abort
filterFound = true;
break;
}
}
return filterFound;
}
/*
* This method attempts to find the ideal place for the Filter element. We
* want to place our filter element before all other filter elements.
* If the filter element is not found, then we try to discover if other
* elements such as servlet are present and then place the filter
* before those elements.
*/
int index = 0;
.getChildElements();
"FilterBase.addFilterElement: Examining element " + name);
"FilterBase.addFilterElement: Found element " + name
+ " in web.xml");
break;
}
}
return index;
}
throws Exception {
boolean result = false;
"FilterBase:hasAgentFilterNameElement(): Examining Filter "
0);
if (filterNameElement.getValue()
.equals(FILTER_NAME)) {
result = true;
"FilterBase:hasAgentFilterNameElement(): " +
"SJS Tomcat Agent Filter has been configured for " +
"this web.xml file");
}
}
return result;
}
private XMLElement addAgentFilterElement(
true);
true);
true);
true);
true);
return filterElem;
}
private XMLElement addAgentFilterMappingElement(
true);
true);
true);
true);
true);
true);
true);
return filterMappingElem;
}
boolean status = false;
int index = 0;
boolean filterFound = false;
boolean match = false;
try {
filterFound = true;
break;
}
}
if (filterFound) {
}
status = true;
"FilterBase.removeFilterElement(): "
+ "Exception caught while removing Agent filter from " +
"the global web.xml file: "
+ ex.getMessage(),
ex);
}
return status;
}
boolean status = false;
int index = 0;
boolean filterFound = false;
boolean match = false;
try {
if ((filterNameElements != null)
.get(0);
if (filterNameElement.getValue()
FILTER_NAME)) {
filterFound = true;
break;
}
}
}
if (filterFound) {
"FilterBase.removeFilterMappingElement(): "
+ "Found Agent filter mapping element");
}
status = true;
"FilterBase.removeFilterElement(): "
+ "Exception caught while removing Agent filter from " +
"the global web.xml file: "
+ ex.getMessage(),
ex);
}
return status;
}
}