Search in sources :

Example 6 with Comment

use of org.xwiki.rest.model.jaxb.Comment in project xwiki-platform by xwiki.

the class TextPlainCommentReader method readFrom.

@Override
public Comment readFrom(Class<Comment> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
    ObjectFactory objectFactory = new ObjectFactory();
    Comment comment = objectFactory.createComment();
    String text = getEntityAsString(entityStream);
    comment.setText(text);
    return comment;
}
Also used : Comment(org.xwiki.rest.model.jaxb.Comment) ObjectFactory(org.xwiki.rest.model.jaxb.ObjectFactory)

Aggregations

Comment (org.xwiki.rest.model.jaxb.Comment)6 GetMethod (org.apache.commons.httpclient.methods.GetMethod)2 Test (org.junit.Test)2 Comments (org.xwiki.rest.model.jaxb.Comments)2 ObjectFactory (org.xwiki.rest.model.jaxb.ObjectFactory)2 CommentsResource (org.xwiki.rest.resources.comments.CommentsResource)2 AbstractHttpTest (org.xwiki.test.rest.framework.AbstractHttpTest)2 XWikiException (com.xpn.xwiki.XWikiException)1 Document (com.xpn.xwiki.api.Document)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1 Form (org.restlet.data.Form)1 InputRepresentation (org.restlet.representation.InputRepresentation)1 Representation (org.restlet.representation.Representation)1 XWikiRestException (org.xwiki.rest.XWikiRestException)1 Link (org.xwiki.rest.model.jaxb.Link)1 CommentResource (org.xwiki.rest.resources.comments.CommentResource)1