Thanks for the reply Colin,
I would like to add information to the request sent to the server,
normally send these informations using the UrlEncoded.
When I do GET, I am writing for example:
Code:
public class UrlBuilder {
protected StringBuilder url = new StringBuilder();
protected boolean first = true;
public void clear()
{
url = new StringBuilder();
first = true;
}
public void addParameter(String name, String value)
{
if (value!=null) {
if (first) first = false;
else url.append('&');
url.append(URL.encodeQueryString(name));
url.append('=');
url.append(URL.encodeQueryString(value));
}
}
public String toString()
{
return url.toString();
}
}
public class PagingLoadUrlEncoder implements
DataWriter<PagingLoadConfig, String> {
protected UrlBuilder urlBuilder = new UrlBuilder();
public String write(PagingLoadConfig config) {
urlBuilder.clear();
urlBuilder.addParameter(ServletParameters.OFFSET,
String.valueOf(config.getOffset()));
urlBuilder.addParameter(ServletParameters.LIMIT,
String.valueOf(config.getLimit()));
if(config.getSortInfo()!=null && !config.getSortInfo().isEmpty()){
SortInfo info = config.getSortInfo().get(0);
urlBuilder.addParameter(ServletParameters.SORTFIELD,
info.getSortField());
urlBuilder.addParameter(ServletParameters.SORTDIR, (info
.getSortDir() == null) ? null : info.getSortDir()
.toString());
}
return urlBuilder.toString();
}
Now if I want to send an object and want to read this server-side object, how should I use the system you speak of? If I want use JSON?