* The template to render for posts
*/
public GetPostAjaxPage(WebInterface webInterface, Template postTemplate) {
- super("ajax/getPost.ajax", webInterface);
+ super("getPost.ajax", webInterface);
this.postTemplate = postTemplate;
}
JsonObject jsonPost = new JsonObject();
jsonPost.put("id", post.getId());
jsonPost.put("sone", post.getSone().getId());
+ jsonPost.put("recipient", (post.getRecipient() == null) ? null : post.getRecipient().getId());
jsonPost.put("time", post.getTime());
- postTemplate.set("post", post);
StringWriter stringWriter = new StringWriter();
- try {
- postTemplate.render(stringWriter);
- } catch (TemplateException te1) {
- /* TODO - shouldn’t happen. */
- } finally {
- Closer.close(stringWriter);
+ synchronized (postTemplate) {
+ postTemplate.set("post", post);
+ try {
+ postTemplate.render(stringWriter);
+ } catch (TemplateException te1) {
+ /* TODO - shouldn’t happen. */
+ } finally {
+ Closer.close(stringWriter);
+ }
}
jsonPost.put("html", stringWriter.toString());
return jsonPost;