On Mon, Jul 18, 2016 at 2:37 PM, Davids Patrick <[email protected]> wrote:
> > How do you make the request ? > I create the url by calling my AbstractDefaultAjaxBehavior instance > .getCallbackUrl(). > I put into a particular link and the javascript (I try to integrate) > executes the link. > > > Now, I try to add it like this: > getCallbackUrl().toString()+"&wicket-ajax=true"; > > Then I run into Bad request errors, wicket base url or something is > missing. > You need one more parameter: https://github.com/apache/wicket/blob/0ff4617437948f7eaabc6fc937af5b745ccc5aba/wicket-request/src/main/java/org/apache/wicket/request/http/WebRequest.java#L45 https://github.com/apache/wicket/blob/0ff4617437948f7eaabc6fc937af5b745ccc5aba/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L579 https://github.com/apache/wicket/blob/0ff4617437948f7eaabc6fc937af5b745ccc5aba/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L83 > > > > Health AG | Patrick Davids | Softwareentwickler > Tel. +49 40 524 709-258 | [email protected] > Fax +49 40 524 709-258 | www.healthag.de > > > EOS Health Honorarmanagement AG | Lübeckertordamm 1–3 | 20099 Hamburg | AG > Hamburg HRB 93806 > Vorstand | Jens Törper, Uwe Schäfer > Aufsichtsratsvorsitzender | Klaus Engberding > > Save a tree – think before you print. > > > -----Ursprüngliche Nachricht----- > Von: Martin Grigorov [mailto:[email protected]] > Gesendet: Montag, 18. Juli 2016 14:28 > An: [email protected] > Betreff: Re: Returning pure HTML using AjaxRequestTarget > > On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick <[email protected]> > wrote: > > > Ok... the problem seem to be isAjax() == false. > > Hmm... but I'm not able to add a parameter to the request, which let > > isAjax() becoming true, which falls through forcing > > shouldRedirectToPage() returning false. > > > > Why not? > How do you make the request ? > > > > > > private boolean shouldRedirectToPage(IRequestCycle requestCycle) { if > > (responseObject.containsPage()) { return true; } > > > > if (((WebRequest)requestCycle.getRequest()).isAjax() == false) { // > > the request was not sent by wicket-ajax.js - this can happen when an > > Ajax request was // intercepted with #redirectToInterceptPage() and > > then the original request is re-sent // by the browser on a subsequent > > #continueToOriginalDestination() return true; } > > > > return false; > > } > > > > > > Health AG | Patrick Davids | Softwareentwickler Tel. +49 40 524 > > 709-258 | [email protected] Fax +49 40 524 709-258 | > > www.healthag.de > > > > > > EOS Health Honorarmanagement AG | Lübeckertordamm 1–3 | 20099 Hamburg > > | AG Hamburg HRB 93806 Vorstand | Jens Törper, Uwe Schäfer > > Aufsichtsratsvorsitzender | Klaus Engberding > > > > Save a tree – think before you print. > > > > > > -----Ursprüngliche Nachricht----- > > Von: Davids Patrick [mailto:[email protected]] > > Gesendet: Montag, 18. Juli 2016 13:50 > > An: [email protected] > > Cc: [email protected] > > Betreff: AW: Returning pure HTML using AjaxRequestTarget > > > > > If you add a Page to AjaxRequestTarget then Wicket will produce a > > redirect Ajax response. > > > > I don't do that. Just adding a single component. > > > > > > > You can use getResponse().write(...) to write raw response instead. > > This was my first try in combination with > > ComponentRenderer.renderComponent(myComponent). > > But I get problems with urls. Some image urls are broken with > > "ComponentNotFoundExceptions". > > renderComponent(myComponent) also writing logs, its not a good idea, > > what I'm doing. ;-) So I changed my implementation to the current way > > using AjaxRequestTarget. > > > > > > Patrick > > > > > > > > Health AG | Patrick Davids | Softwareentwickler Tel. +49 40 524 > > 709-258 | [email protected] Fax +49 40 524 709-258 | > > www.healthag.de > > > > > > EOS Health Honorarmanagement AG | Lübeckertordamm 1–3 | 20099 Hamburg > > | AG Hamburg HRB 93806 Vorstand | Jens Törper, Uwe Schäfer > > Aufsichtsratsvorsitzender | Klaus Engberding > > > > Save a tree – think before you print. > > > > > > -----Ursprüngliche Nachricht----- > > Von: Martin Grigorov [mailto:[email protected]] > > Gesendet: Montag, 18. Juli 2016 13:29 > > An: [email protected] > > Betreff: Re: Returning pure HTML using AjaxRequestTarget > > > > Hi, > > > > If you add a Page to AjaxRequestTarget then Wicket will produce a > > redirect Ajax response. > > > > I am not sure how far you can go with AjaxRequestTarget#add() though. > > You can use getResponse().write(...) to write raw response instead. > > Or schedule another IRequestHandler to render the response, as in > > https://github.com/wicketstuff/core/blob/793d2cbaa97d6f2650b9f5ababb7e > > 46226c4b716/autocomplete-tagit-parent/autocomplete-tagit/src/main/java > > /org/wicketstuff/tagit/TagItAjaxBehavior.java#L50 > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > On Mon, Jul 18, 2016 at 1:16 PM, Davids Patrick <[email protected]> > > wrote: > > > > > Hi all, > > > I'm working on a integration of a javascript which does html > > > replacements by itself. > > > > > > So, it expects pure HTML and what I try to achieve is, becoming > > > wicket returning the HTML via AjaxRequest.add(...). > > > > > > I've seen the methods setDataType("html") and > > > setWicketAjaxResponse(false) of AjaxRequestAttributes. > > > I thought this would be the solution. Just getting a html snippet > > > not processed by wickets client-side ajax features. > > > > > > My problem now is, I don't get a html part, but an redirect 302 > > > pointing to a url which returns the entire webpage. > > > > > > Where does this 302 come from? > > > And why does it point the page url? > > > How can I change that behavior, so just returning the html snippets > > > of components added to the AjaxRequestTarget? > > > > > > Thanx for help! > > > kind regards > > > Patrick > > > > > > Health AG | Patrick Davids | Softwareentwickler Tel. +49 40 524 > > > 709-258 | [email protected] Fax +49 40 524 709-258 | > > > www.healthag.de > > > > > > > > > EOS Health Honorarmanagement AG | Lübeckertordamm 1–3 | 20099 > > > Hamburg > > > | AG Hamburg HRB 93806 Vorstand | Jens Törper, Uwe Schäfer > > > Aufsichtsratsvorsitzender | Klaus Engberding > > > > > > Save a tree – think before you print. > > > > > > > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > >
