/**
* Removes the parameter from the placeRequest
* @param placeRequest
* @param parameter to be removed from placeRequest
* @return
*/
public static PlaceRequest removeParameter(final PlaceRequest placeRequest,
final String parameter){
//Sanity checks
assert( placeRequest != null ) : "placeRequest cannot be null";
assert( parameter != null ) : "parameter cannot be null";
// Create return object
PlaceRequest rtn = new PlaceRequest( placeRequest.getNameToken() );
// Gets all the parameters names
Set<String> set = placeRequest.getParameterNames();
if( set != null ){
for( String key : set){
// Add parameter to rtn as long as its not the parameter to remove
if( !key.equals(parameter) ){
// Value
String val = placeRequest.getParameter(key, null);
// Add
rtn = rtn.with(key, val);
}
}
}
return rtn;
}
To me you process a PlaceRequest in prepareFromRequest. If you have a parameter that you need to remove, it means that the PlaceRequest contains wrong information. Why do you have the parameter you want to delete in your PlaceRequest? I don't understand the need to remove a parameter from a PlaceRequest. Why don't you create a new PlaceRequest containing only the parameter you need. If you don't want to display the TextBox, create a PlaceRequest without the url param.