|
Hi,
From a JavaScript code (CkEditor pluin to be exact), I want to send data to my wicket component/panel. I traced the generated code, and it uses "wicketAjaxGet". With wicketAjaxGet I can get in 3000+ characters on a rough. This seems to have size limitation, whats the best way to get around that? Additional Context -------------------- Would like this to be as scalable as possible so I can send Contents in my CkEditor on my Custom Ajax-Save button. Basically have created a plugin in CkEditor and have my Ajax-Save on the Editor Toolbar (no Wicket button). I have a Proxy link that generates the script, and then on JavaScript I simply rip that off and do an eval (<server generated function code + modifications). This submits back the data to the server and it all works well. Just the size limit bothers me a bit. Have avoided using forms sicxe I dont see a conceptual need for forms. wicketAjaxPost or wicketSerializeForm (?) ---------------------------------------------- ....Discussion sake .... (maybe not relevant) I saw some post few months back where guy talks about wicketAjaxPost and serializing Forms using wicketSerializeForm. But no code or context provided so not sure how that works. plus wicketSerializeForm takes only one param ... the form element in javbscript. So how does it send data back to server? Preferred Area of Solution ------------------------- Note: This script can be modified @ the server in public final CharSequence getCallbackUrl(final boolean onlyTargetActivePage) ; Looking for some server side wizardry so I dont have to put in Hacke (replace commands in javascript).
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
Use Post instead of using Get, limitation is set by Browsers.
see: wicketAjaxPost function
On Sun, Sep 25, 2011 at 8:13 AM, Arjun Dhar [via Apache Wicket] <[hidden email]> wrote: Hi, JC |
|
In reply to this post by Arjun Dhar
https://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html
On Sun, Sep 25, 2011 at 11:23 AM, Juan Carlos Garcia <[hidden email]> wrote: Use Post instead of using Get, limitation is set by Browsers. JC |
|
Actually i did try that also and in the HTTP Live header plugin I can see its getting POST'ed. yet for some reason content larger than a certain size is not going.
I hope this is not a problem with CKEditor or Jetty (standard config) thanks for the tip. I'll check other things to see why large size is not working out. If you have any suggestions, I'll followup.
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
Found root cause; confirm.
Am getting a HTTP 413 return (Server puking it on Post) ...any suggestions?
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
When using Post, are you seeing a "content-length" header?
On Sun, Sep 25, 2011 at 4:29 PM, Arjun Dhar [via Apache Wicket] <[hidden email]> wrote: Found root cause; confirm. JC |
|
In reply to this post by Arjun Dhar
Since it was a server error, I changed the "headerBufferSize" config in Jetty and it worked
..but then on changing Jetty Config wicketAjaxPost & wicketAjaxGet were both working. "headerBufferSize" uses the request header imo, so on post why do we need the request header? ..Something does not seem right with my understanding of these functions or perhaps how JETTY handles requests. Its left me a little confused :( Jetty config fix -------------- <!-- http://docs.codehaus.org/display/JETTY/Configuring+Connectors --><raw><connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>9090</port> <maxIdleTime>60000</maxIdleTime> <headerBufferSize>24000</headerBufferSize> </connector> ..what im still worried about is the HeaderBuffer Size
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
When using GET content is limited per browser. ie: Modern Browser set a limit to 8K while others just 2K.
When using POST per the spec browser are mandate to set content-length header, i have no idea what is going on your end, but definitely will suggest to try that out on a different container such as Tomcat just to see if this is something Jetty related.
On Sun, Sep 25, 2011 at 4:58 PM, Arjun Dhar [via Apache Wicket] <[hidden email]> wrote: Since it was a server error, I changed the "headerBufferSize" config in Jetty and it worked JC |
|
In reply to this post by Arjun Dhar
Aren't you sending your data in the url? Even if you are using POST you can
still have some (all) data in the url as query parameters. And there are limits for url length (both on client/browser side and server side). This would also explain why does it depend on header buffer size as the url is read into that buffer. Attila 2011/9/25 Arjun Dhar <[hidden email]> > Since it was a server error, I changed the "headerBufferSize" config in > Jetty > and it worked > ..but then on changing Jetty Config wicketAjaxPost & wicketAjaxGet were > both > working. > > "headerBufferSize" uses the request header imo, so on post why do we need > the request header? > ..Something does not seem right with my understanding of these functions or > perhaps how JETTY handles requests. > > Its left me a little confused :( > > > Jetty config fix > -------------- > > <connector > implementation="org.mortbay.jetty.nio.SelectChannelConnector"> > > <port>9090</port> > > <maxIdleTime>60000</maxIdleTime> > > <headerBufferSize>24000</headerBufferSize> > </connector> > > > > ..what im still worried about is the HeaderBuffer Size > > ----- > Software documentation is like sex: when it is good, it is very, very good; > and when it is bad, it is still better than nothing! > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/wicketAjaxGet-Size-limt-tp3841117p3842018.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > > |
|
In reply to this post by jcgarciam
"When using Post, are you seeing a "content-length" header?"
Yes, but its '0': http://localhost:9090/sampleApp/admin.contentPages?wicket:interface=:2:contentDetails:contentPageForm:template:facets:0:facet:ckEditor:updateContentProxyLink::IActivePageBehaviorListener:1:-1&wicket:ignoreIfNotActive=true&pid=mainContentBody&pval=%3C%21DOCTYPE%20htm ...... really long content ..... 2%29%0A%0A%3C/script%3E%0A%0A%3C/body%3E%0A%3C/html%3E%0A&random=0.8741321687834053 HTTP/1.1 Host: localhost:9090 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17 Accept: text/xml Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Wicket-Ajax: true Referer: http://localhost:9090/sampleApp/admin.contentPages Cookie: JSESSIONID=1y2lvyb8sxl7 Pragma: no-cache Cache-Control: no-cache Content-Length: 0 HTTP/1.1 200 OK Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: no-cache, must-revalidate Content-Type: text/xml; charset=utf-8 Pragma: no-cache Content-Length: 69 Server: Jetty(6.1.16)
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
In reply to this post by Attila Király
I'm seeing you request is still being sent as GET, since your parameters are bound to the URL. If it would have been POST the content of your request would appear below the:
Content-Length:wwww Yor content here....
On Sun, Sep 25, 2011 at 5:05 PM, Attila Király [via Apache Wicket] <[hidden email]> wrote: Aren't you sending your data in the url? Even if you are using POST you can JC |
|
This post was updated on .
Attila Király & jcgarciam --- Yup, thats it I guess. You guys are right (i think)
I was just blindly hacking the urls & using the wicket functions. I see now : function wicketAjaxPost(url, body, successHandler, failureHandler, precondition, channel) ..and what I'm consuming is only the URL param. Example:
var wcall =
wicketAjaxPost("?wicket:interface=:2:contentDetails:contentPageForm:template:facets:0:facet:ckEditor:updateContentProxyLink::IActivePageBehaviorListener:1:-1&wicket:ignoreIfNotActive=true
&pid=mainContentBody&pval=ArjunDharCOntent",
function () {}.bind(this), function () {}.bind(this),
function () {return Wicket.$("proxyLink_0") != null;}.bind(this));
I should be using the second param for POST to really take advantage. Thank you all. Yup, it all makes sense now.
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
|
Hi, its working now. For the sake of dcoumentation anyone looking to override how their Component does a callback on a custom behaviorthat extends AbstractDefaultAjaxBehavior :
@Override
protected final CharSequence getCallbackScript(boolean onlyTargetActivePage) {
return generateCallbackScript( (post?"wicketAjaxPost":"wicketAjaxGet") +
"('" + getCallbackUrl(onlyTargetActivePage) + "'"
+ (post?",'"+getBody()+"'":"")); //In POST a body also comes
}
...
protected CharSequence getBody() {
return PARAM_VALUE + "=" + paramValue; //How Big is Big, ....dont care!
}
..Will adapt to GET & POST accordingly. tx
Software documentation is like sex: when it is good, it is very, very good; and when it is bad, it is still better than nothing!
|
| Powered by Nabble | Edit this page |
