public class LayoutColumnJSONWriter implements MessageBodyWriter<LayoutColumn> {
private String jsonRep = null;
public long getSize(LayoutColumn layoutColumn, Class<?> type,
Type genericType, Annotation[] annotations, MediaType mediaType) {
LayoutColumnJSONSerializer serializer = new LayoutColumnJSONSerializer();
try {
if (jsonRep == null)
jsonRep = serializer.convertToString(layoutColumn);
return jsonRep.getBytes("utf-8").length;
} catch(Exception ex) {
return -1;
}
}