}
@SuppressWarnings("unchecked")
private String createURLWithWebRequest(Map parameterValues, GrailsWebRequest webRequest, boolean includeContextPath) {
GrailsRequestStateLookupStrategy requestStateLookupStrategy = new DefaultRequestStateLookupStrategy(webRequest);
final String encoding = requestStateLookupStrategy.getCharacterEncoding();
String id = null;
if (parameterValues.containsKey(ARGUMENT_ID)) {
Object o = parameterValues.get(ARGUMENT_ID);
if (o != null) {
id = o.toString();
}
}
FastStringWriter actualUriBuf = new FastStringWriter();
if (includeContextPath) {
actualUriBuf.append(requestStateLookupStrategy.getContextPath());
}
if (actionName != null) {
if (actionName.indexOf(SLASH) > -1) {
actualUriBuf.append(actionName);
}
else {
if (controllerName != null) {
appendUrlToken(actualUriBuf, controllerName, encoding);
}
else {
appendUrlToken(actualUriBuf, requestStateLookupStrategy.getControllerName(), encoding);
}
}
appendUrlToken(actualUriBuf, actionName, encoding);
}
if (id != null) {