Hello,
I was trying to write a program which would upload new pages on my wiki. I
was following these instructions
http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI , but
unfortunately most of the examples use old version of Apache's HTTP library,
so they are not very useful for me
Hi,
You can use the new version of Apache's HTTP library, as follows, hope
it'll help you.
public class RestTest {
/**
* Create and initialize the http client.
*
* @return an HttpClient object
*/
HttpClient getClient(host, port, username, password) {
HttpClient httpClient
Thank you for your response!
As far as I know there is no PutMethod (which you use in your code) class in
new versions of Apache's HTTP library. Same goes for many other methods
which.
Or maybe I'm just missing the point and there IS a library with required
Classes and Methods of which I know not
Hi,
I forget to add the packages to import in my previous code.
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apac
For some reasons it gives me this
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
at org.apache.commons.httpclient.HttpClient.(HttpClient.java:65)
at RestTest2.getClient(RestTest2.java:16)
at RestTest2.main(RestTest2.java:27)
That's because what Mohamed is referring is the old (3.x) HttpClient
and not the new (4.x) one which have different (sometime very
different) API.
The main issue you have is probably the fact that XWiki does not ask
the client for credential by default since anonymous access is valid.
That means y