use of org.grails.buffer.FastStringWriter in project grails-core by grails.
the class DefaultUrlCreator method createURLWithWebRequest.
@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) {
appendUrlToken(actualUriBuf, id, encoding);
}
appendRequestParams(actualUriBuf, parameterValues, encoding);
return actualUriBuf.toString();
}
use of org.grails.buffer.FastStringWriter in project grails-core by grails.
the class XML method toString.
@Override
public String toString() {
FastStringWriter strw = new FastStringWriter();
render(strw);
strw.flush();
return strw.toString();
}
Aggregations