public void addUniqueParameterToLink(String name, String value) {
final Info info = this.getInfo();
if ( info.hasParameters ) {
final int pos = info.linkBase.toString().indexOf("?");
final String queryString = info.linkBase.substring(pos + 1);
final RequestParameters params = new RequestParameters(queryString);
if ( params.getParameter(name) != null ) {
// the parameter is available, so remove it
info.linkBase.delete(pos, info.linkBase.length() + 1);
info.hasParameters = false;
Enumeration enumeration = params.getParameterNames();
while ( enumeration.hasMoreElements() ) {
final String paramName = (String)enumeration.nextElement();
if ( !paramName.equals(name) ) {
String[] values = params.getParameterValues(paramName);
for( int i = 0; i < values.length; i++ ) {
this.addParameterToLink(paramName, values[i]);
}
}
}