Re: Calling Wicket from JS

2018-05-25 Thread Zbynek Vavros
Thanks Martin, exactly what I was looking for!

On Fri, May 25, 2018 at 1:54 PM, Martin Grigorov 
wrote:

> Hi,
>
> You need to use POST method for your Ajax request.
> See AbstractDefaultAjaxBehavior#updateAjaxAttributes()
>
> On Fri, May 25, 2018 at 2:41 PM, Zbynek Vavros 
> wrote:
>
> > Hey,
> >
> > I am using the callBackScript() of AbstractDefaultAjaxBehavior:
> > AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior()
> {
> >
> > @Override
> > public CharSequence getCallbackFunction(CallbackParameter...
> > extraParameters) {
> > return super.getCallbackFunction(extraParameters);
> > }
> >
> > @Override
> > public void renderHead(Component component, IHeaderResponse
> > response) {
> > super.renderHead(component, response);
> > String callBackScript =
> > getCallbackFunction(CallbackParameter.explicit(JS_PARAM_CERTIFICATE),
> > CallbackParameter.explicit(JS_PARAM_CERTIFICATE_CHAIN)).toString();
> > callBackScript = "sendCertificate=" + callBackScript +
> ";";
> >
> > response.render(OnDomReadyHeaderItem.forScript(callBackScript));
> > }
> >
> > protected void respond(final AjaxRequestTarget target) {
> >
> > String certificate =
> > getRequest().getRequestParameters().getParameterValue(JS_PARAM_
> > CERTIFICATE).toString();
> > String certificateChain =
> > getRequest().getRequestParameters().getParameterValue(JS_PARAM_
> > CERTIFICATE_CHAIN).toString();
> > }
> > };
> > add(behavior);
> >
> >
> > The problem is that I need to send certificate and certificateChain from
> JS
> > and these are obviously quite long. Thus I am getting " Wicket.Ajax:
> > Wicket.Ajax.Call.failure:
> > Error while parsing response: Request-URI Too Long".
> >
> > Any idea how to solve this?
> >
> > I am on Wicket 7.0.0...
> >
> > Thanks,
> > Zbynek
> >
>


Re: Calling Wicket from JS

2018-05-25 Thread Martin Grigorov
Hi,

You need to use POST method for your Ajax request.
See AbstractDefaultAjaxBehavior#updateAjaxAttributes()

On Fri, May 25, 2018 at 2:41 PM, Zbynek Vavros 
wrote:

> Hey,
>
> I am using the callBackScript() of AbstractDefaultAjaxBehavior:
> AbstractDefaultAjaxBehavior behavior = new AbstractDefaultAjaxBehavior() {
>
> @Override
> public CharSequence getCallbackFunction(CallbackParameter...
> extraParameters) {
> return super.getCallbackFunction(extraParameters);
> }
>
> @Override
> public void renderHead(Component component, IHeaderResponse
> response) {
> super.renderHead(component, response);
> String callBackScript =
> getCallbackFunction(CallbackParameter.explicit(JS_PARAM_CERTIFICATE),
> CallbackParameter.explicit(JS_PARAM_CERTIFICATE_CHAIN)).toString();
> callBackScript = "sendCertificate=" + callBackScript + ";";
>
> response.render(OnDomReadyHeaderItem.forScript(callBackScript));
> }
>
> protected void respond(final AjaxRequestTarget target) {
>
> String certificate =
> getRequest().getRequestParameters().getParameterValue(JS_PARAM_
> CERTIFICATE).toString();
> String certificateChain =
> getRequest().getRequestParameters().getParameterValue(JS_PARAM_
> CERTIFICATE_CHAIN).toString();
> }
> };
> add(behavior);
>
>
> The problem is that I need to send certificate and certificateChain from JS
> and these are obviously quite long. Thus I am getting " Wicket.Ajax:
> Wicket.Ajax.Call.failure:
> Error while parsing response: Request-URI Too Long".
>
> Any idea how to solve this?
>
> I am on Wicket 7.0.0...
>
> Thanks,
> Zbynek
>