eldur / jwbf

Java Wiki Bot Framework is a library to maintain Wikis like Wikipedia based on MediaWiki.
http://jwbf.sourceforge.net/
Apache License 2.0
78 stars 33 forks source link

Request-URI Too Large #10

Closed lorinczz closed 10 years ago

lorinczz commented 10 years ago

I wrote a post action based on your last module and other post actions. It works with smaller requests, but with larger ones I get Exception in thread "main" java.lang.IllegalStateException: invalid status: HTTP/1.1 414 Request-URI Too Large; for ... at net.sourceforge.jwbf.core.actions.HttpActionClient.execute(HttpActionClient.java:299). Could you help me?

eldur commented 10 years ago

I assume you try to send new data to your server ... try to submit your data via POST e.g. PostModifyContent

lorinczz commented 10 years ago

I don't get the mistake. I told you that it works if the request is not very large.

eldur commented 10 years ago

HTTP/1.1 414 Request-URI Too Large

is a server response, if you send a very long GET request, so try a POST request.

lorinczz commented 10 years ago

All my params are added with .param. Is this the difference? .param and .addParam? The server doesn't accept GET request at all for the action in case.

eldur commented 10 years ago
    Post post = new ApiRequestBuilder() //
        .param("getKey", "IAssumeThisCausesTheProblem") //
        .buildPost();
    post.addParam("postKey", "thisIsThePostDataAndCanBeVeryLong");
// curl --data "postKey=thisIsThePostDataAndCanBeVeryLong" \
//     "http://.../api.php?getKey=IAssumeThisCausesTheProblem"
lorinczz commented 10 years ago

Thank youuuuu!

eldur commented 10 years ago

with this change you can also write

    Post post = new ApiRequestBuilder() //
        .param("getKey", "IAssumeThisCausesTheProblem") //
        .buildPost() //
        .param("postKey", "thisIsThePostDataAndCanBeVeryLong");
lorinczz commented 10 years ago

Thanks.

lorinczz commented 10 years ago

I wanted to use postParam with the latest snapshot and it says "The method postParam(String, String) is undefined for the type Post".

eldur commented 10 years ago

The method postParam(String key, Object value) should be there

I've triggered a new build, I'll hope this fix the problem.

lorinczz commented 10 years ago

It works now, thank you.