Hi Jerome,
Ya of course having /wikis/{wikiName}/users would have been nice. :)
But coming to reality, I still have the problem creating user.
Here is the code on how I created the wiki page.
Can you advise me how to create the wiki user in the similiear manner?
public void myAddMethod()
{
final String CONTENT = "Content 101";
final String TITLE = "Title 101";
final String PARENT = "Private.WebHome";
ObjectFactory objectFactory = new ObjectFactory();
Page page = objectFactory.createPage();
page.setContent(CONTENT);
page.setTitle(TITLE);
page.setParent(PARENT);
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, new
UsernamePasswordCredentials("admin", "admin"));
httpClient.getParams().setAuthenticationPreemptive(true);
JAXBContext context;
try {
context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
Marshaller marshaller = context.createMarshaller();
Unmarshaller unmarshaller = context.createUnmarshaller();
PutMethod putMethod = new
PutMethod("http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Private/pages/NewPage01");
putMethod.addRequestHeader("Accept",
MediaType.APPLICATION_XML.toString());
StringWriter writer = new StringWriter();
marshaller.marshal(page, writer);
RequestEntity entity;
entity = new StringRequestEntity(writer.toString(),
MediaType.APPLICATION_XML.toString(), "UTF-8");
putMethod.setRequestEntity(entity);
httpClient.executeMethod(putMethod);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
--
View this message in context:
http://xwiki.475771.n2.nabble.com/How-to-add-a-page-with-contents-in-xwiki-…
Sent from the XWiki- Users mailing list archive at
Nabble.com.