AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
> - the image could not be found because there is no such parent component

Ok, I think begin to understand... but then I've a detailed question about 
AbstractPagableView/DataView.
They are RefreshingViews and able to render as paginators. E.g. only first 10 
items of 30.

populateItem(...) is called only 10 times for first iteration.
The second paginating request renders further 10 items and so on.

How can the further/next items become part of the hierarchy?
Whats the different between "Wicket renders the second 10 items" and 
"ComponentRenderer.renderComponent()" renders the second 10 items.

How do items participate to the page hierarchy when wicket renders vs. 
ComponentRenderer renders?




Health AG | Patrick Davids | Softwareentwickler
Tel. +49 40 524 709-258 | p.dav...@healthag.de
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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 16:05
An: users@wicket.apache.org
Betreff: Re: Returning pure HTML using AjaxRequestTarget

Here is what happens:
- you render some HTML from a *temporary* component, i.e. this component is not 
member of the page's component tree
- your JS code to renders this HTML
- since there are  in the HTML additional HTTP calls are made to load them
- the image could not be found because there is no such parent component

Consider using ImageResourceReference (from your other mail recently) instead.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Jul 18, 2016 at 3:45 PM, Davids Patrick 
wrote:

> >Request#getClientUrl() is the base url. It is used to calculate
> >relative
> urls.
> >ComponentRenderer.renderComponent() uses the current Request, so the
> >url
> should be whatever you pass as wicket-ajax->baseurl
>
> Hmm... here an example...
> (The component, I render via ComponentRenderer.renderComponent()
> returns a list of images.) Those urls are broken...
>
> e.g.
>
> http://127.0.0.1:/myTest/wicket/page?188-IResourceListener-contain
> er-11-item-link-box-image
> &antiCache=1468849116540
>
> 2016-07-18 15:38:36,677 ERROR wicket.DefaultExceptionMapper -
> Unexpected error occurred
> org.apache.wicket.core.request.handler.ComponentNotFoundException:
> Component 'container:11:item:link:box:image' has been removed from page.
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler
> .respond(ListenerInterfaceRequestHandler.java:178)
> ~[wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(R
> equestCycle.java:890)
> ~[wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerSt
> ack.java:64)
> ~[wicket-request-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java
> :261)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCyc
> le.java:218)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(R
> equestCycle.java:289)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(Wicke
> tFilter.java:259)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilt
> er.java:201)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.jav
> a:282)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> cationFilterChain.java:241)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> lterChain.java:208)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> lve.java:220)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
> lve.java:122)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
> orBase.java:505)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
> va:170)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
> va:103)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:9
> 57)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
> e.java:116)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.conn

Re: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Martin Grigorov
Here is what happens:
- you render some HTML from a *temporary* component, i.e. this component is
not member of the page's component tree
- your JS code to renders this HTML
- since there are  in the HTML additional HTTP calls are made to load
them
- the image could not be found because there is no such parent component

Consider using ImageResourceReference (from your other mail recently)
instead.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Jul 18, 2016 at 3:45 PM, Davids Patrick 
wrote:

> >Request#getClientUrl() is the base url. It is used to calculate relative
> urls.
> >ComponentRenderer.renderComponent() uses the current Request, so the url
> should be whatever you pass as wicket-ajax->baseurl
>
> Hmm... here an example...
> (The component, I render via ComponentRenderer.renderComponent() returns a
> list of images.)
> Those urls are broken...
>
> e.g.
>
> http://127.0.0.1:/myTest/wicket/page?188-IResourceListener-container-11-item-link-box-image
> &antiCache=1468849116540
>
> 2016-07-18 15:38:36,677 ERROR wicket.DefaultExceptionMapper - Unexpected
> error occurred
> org.apache.wicket.core.request.handler.ComponentNotFoundException:
> Component 'container:11:item:link:box:image' has been removed from page.
> at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
> ~[wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
> ~[wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> ~[wicket-request-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
> [wicket-core-6.22.0.jar:6.22.0]
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
> [catalina.jar:7.0.62]
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
> [catalina.jar:7.0.62]
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
> [tomcat-coyote.jar:7.0.62]
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
> [tomcat-coyote.jar:7.0.62]
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
> [tomcat-coyote.jar:7.0.62]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> [?:1.7.0_79]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> [?:1.7.0_79]
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> [tomcat-coyote.jar:7.0.62]
> at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]
>
>
>
>
> Health AG | Patrick Davids | Softwareentwickler
> Tel. +49 40 524 709-258 | p.dav...@healthag.de
> 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 [ma

AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
>Request#getClientUrl() is the base url. It is used to calculate relative urls.
>ComponentRenderer.renderComponent() uses the current Request, so the url 
>should be whatever you pass as wicket-ajax->baseurl

Hmm... here an example...
(The component, I render via ComponentRenderer.renderComponent() returns a list 
of images.)
Those urls are broken...

e.g.
http://127.0.0.1:/myTest/wicket/page?188-IResourceListener-container-11-item-link-box-image
&antiCache=1468849116540

2016-07-18 15:38:36,677 ERROR wicket.DefaultExceptionMapper - Unexpected error 
occurred
org.apache.wicket.core.request.handler.ComponentNotFoundException: Component 
'container:11:item:link:box:image' has been removed from page.
at 
org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:178)
 ~[wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:890)
 ~[wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 ~[wicket-request-6.22.0.jar:6.22.0]
at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261) 
[wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
 [wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
 [wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
 [wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
 [wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) 
[wicket-core-6.22.0.jar:6.22.0]
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) 
[catalina.jar:7.0.62]
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) 
[catalina.jar:7.0.62]
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957) 
[catalina.jar:7.0.62]
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
 [catalina.jar:7.0.62]
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) 
[catalina.jar:7.0.62]
at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
 [tomcat-coyote.jar:7.0.62]
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
 [tomcat-coyote.jar:7.0.62]
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
 [tomcat-coyote.jar:7.0.62]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
[?:1.7.0_79]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
[?:1.7.0_79]
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 [tomcat-coyote.jar:7.0.62]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]




Health AG | Patrick Davids | Softwareentwickler
Tel. +49 40 524 709-258 | p.dav...@healthag.de
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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 15:37
An: users@wicket.apache.org
Betreff: Re: Returning pure HTML using AjaxRequestTarget

On Mon, Jul 18, 2016 at 3:28 PM, Davids Patrick 
wrote:

> Ok, got it.
>
> I think, the approach using the AjaxRequestTarget is wrong for my case.
> My response is wrapped into xml which is used by wickets client side
> ajax javascript, I think.
>
>
> So, I think I will go back to the idea using
> ComponentRender.renderComponent()
>
>
> @Override
> public void respond(final IRequestCycle requestCycle){
>
> WebResponse response = (WebResponse) requestCycle.getResponse();
>
> final String encoding =
> Application.get().getRequestCycleSettings()

Re: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Martin Grigorov
On Mon, Jul 18, 2016 at 3:28 PM, Davids Patrick 
wrote:

> Ok, got it.
>
> I think, the approach using the AjaxRequestTarget is wrong for my case.
> My response is wrapped into xml which is used by wickets client side ajax
> javascript, I think.
>
>
> So, I think I will go back to the idea using
> ComponentRender.renderComponent()
>
>
> @Override
> public void respond(final IRequestCycle requestCycle){
>
> WebResponse response = (WebResponse) requestCycle.getResponse();
>
> final String encoding =
> Application.get().getRequestCycleSettings().getResponseRequestEncoding();
> response.setContentType("plan/html; charset=" + encoding);
> response.disableCaching();
>
> response.write(ComponentRenderer.renderComponent(myComponent));
> }
>
> Except the broken urls it is working quite ok.
>
> Any hint why those links are broken?
>

Request#getClientUrl() is the base url. It is used to calculate relative
urls.
ComponentRenderer.renderComponent() uses the current Request, so the url
should be whatever you pass as wicket-ajax-baseurl


>
>
>
>
>
> Health AG | Patrick Davids | Softwareentwickler
> Tel. +49 40 524 709-258 | p.dav...@healthag.de
> 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:mgrigo...@apache.org]
> Gesendet: Montag, 18. Juli 2016 14:42
> An: users@wicket.apache.org
> Betreff: Re: Returning pure HTML using AjaxRequestTarget
>
> On Mon, Jul 18, 2016 at 2:37 PM, Davids Patrick 
> 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 | p.dav...@healthag.de 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:mgrigo...@apache.org]
> > Gesendet: Montag, 18. Juli 2016 14:28
> > An: users@wicket.apache.org
> > Betreff: Re: Returning pure HTML using AjaxRequestTarget
> >
> > On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick 
> > 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 | p.dav...@healthag.de 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:p.dav...@healthag.de]
> > > Gesendet: Montag, 18. Juli 2016 13:50
> > > An: users@wicket.apache.org
> > > Cc: mgrigo...@apache.org
> > > Betreff: AW: Returning pure HTML using AjaxRequestTarget
> > >
> > > > If you add a Page to AjaxRequestTarget then Wicket will produce a
> > > red

AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
Ok, got it.

I think, the approach using the AjaxRequestTarget is wrong for my case.
My response is wrapped into xml which is used by wickets client side ajax 
javascript, I think.


So, I think I will go back to the idea using ComponentRender.renderComponent()


@Override
public void respond(final IRequestCycle requestCycle){

WebResponse response = (WebResponse) requestCycle.getResponse();

final String encoding = 
Application.get().getRequestCycleSettings().getResponseRequestEncoding();
response.setContentType("plan/html; charset=" + encoding);
response.disableCaching();

response.write(ComponentRenderer.renderComponent(myComponent));
}

Except the broken urls it is working quite ok.

Any hint why those links are broken?





Health AG | Patrick Davids | Softwareentwickler
Tel. +49 40 524 709-258 | p.dav...@healthag.de
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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 14:42
An: users@wicket.apache.org
Betreff: Re: Returning pure HTML using AjaxRequestTarget

On Mon, Jul 18, 2016 at 2:37 PM, Davids Patrick 
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 | p.dav...@healthag.de 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:mgrigo...@apache.org]
> Gesendet: Montag, 18. Juli 2016 14:28
> An: users@wicket.apache.org
> Betreff: Re: Returning pure HTML using AjaxRequestTarget
>
> On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick 
> 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 | p.dav...@healthag.de 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:p.dav...@healthag.de]
> > Gesendet: Montag, 18. Juli 2016 13:50
> > An: users@wicket.apache.org
> > Cc: mgrigo...@apache.org
> > 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.

Re: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Martin Grigorov
On Mon, Jul 18, 2016 at 2:37 PM, Davids Patrick 
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 | p.dav...@healthag.de
> 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:mgrigo...@apache.org]
> Gesendet: Montag, 18. Juli 2016 14:28
> An: users@wicket.apache.org
> Betreff: Re: Returning pure HTML using AjaxRequestTarget
>
> On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick 
> 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 | p.dav...@healthag.de 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:p.dav...@healthag.de]
> > Gesendet: Montag, 18. Juli 2016 13:50
> > An: users@wicket.apache.org
> > Cc: mgrigo...@apache.org
> > 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 | p.dav...@healthag.de 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:mgrigo...@apache.org]
> > Gesendet: Montag, 18. Juli 2016 13:29
> > An: users@wicket.apache.org
> > 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, 

AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
> 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.



Health AG | Patrick Davids | Softwareentwickler
Tel. +49 40 524 709-258 | p.dav...@healthag.de
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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 14:28
An: users@wicket.apache.org
Betreff: Re: Returning pure HTML using AjaxRequestTarget

On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick 
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 | p.dav...@healthag.de 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:p.dav...@healthag.de]
> Gesendet: Montag, 18. Juli 2016 13:50
> An: users@wicket.apache.org
> Cc: mgrigo...@apache.org
> 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 | p.dav...@healthag.de 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:mgrigo...@apache.org]
> Gesendet: Montag, 18. Juli 2016 13:29
> An: users@wicket.apache.org
> 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 
> 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 th

Re: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Martin Grigorov
On Mon, Jul 18, 2016 at 2:18 PM, Davids Patrick 
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 | p.dav...@healthag.de
> 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:p.dav...@healthag.de]
> Gesendet: Montag, 18. Juli 2016 13:50
> An: users@wicket.apache.org
> Cc: mgrigo...@apache.org
> 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 |
> p.dav...@healthag.de 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:mgrigo...@apache.org]
> Gesendet: Montag, 18. Juli 2016 13:29
> An: users@wicket.apache.org
> 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/793d2cbaa97d6f2650b9f5ababb7e46226c4b716/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 
> 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 | p.dav...@healthag.de 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: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>


AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
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.

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 | p.dav...@healthag.de
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:p.dav...@healthag.de]
Gesendet: Montag, 18. Juli 2016 13:50
An: users@wicket.apache.org
Cc: mgrigo...@apache.org
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 | 
p.dav...@healthag.de 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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 13:29
An: users@wicket.apache.org
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/793d2cbaa97d6f2650b9f5ababb7e46226c4b716/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 
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 | p.dav...@healthag.de 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: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


AW: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
> 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 | p.dav...@healthag.de
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:mgrigo...@apache.org]
Gesendet: Montag, 18. Juli 2016 13:29
An: users@wicket.apache.org
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/793d2cbaa97d6f2650b9f5ababb7e46226c4b716/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 
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 | p.dav...@healthag.de 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: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Martin Grigorov
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/793d2cbaa97d6f2650b9f5ababb7e46226c4b716/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 
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 | p.dav...@healthag.de
> 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: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Returning pure HTML using AjaxRequestTarget

2016-07-18 Thread Davids Patrick
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 | p.dav...@healthag.de
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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Accessing Wicket session from within a Servlet

2016-07-18 Thread Ernesto Reinaldo Barreiro
See WicketSessionFilter


*/**  * This filter can be used to make the Wicket {**@link *

*org.apache.wicket.protocol.http.WebSession}  * instances available to
non-wicket servlets.  * ***



*  * The following example shows how this filter is setup to for a servlet.
You can find the example  * in the wicket-examples project.  *  * ***
*  *  **<**!-- The WicketSesionFilter can be used to provide thread
local access to servlets/ JSPs/ etc --**>*
*  *  **<**filter**>*
*  ***<**filter-name**>**WicketSessionFilter**<**/filter-name*
*>*
*  ***<**filter-class**>*
*org.apache.wicket.protocol.http.servlet.WicketSessionFilter**<*
*/filter-class**>*
*  ***<**init-param**>*
*  *  **<**param-name**>**filterName**<**/param-name**>*
*  *  **<**!-- expose the session of the input example app --**>*
*  *  **<**param-value**>**FormInputApplication**<*
*/param-value**>*
*  ***<**/init-param**>*
*  *  **<**/filter**>*

On Mon, Jul 18, 2016 at 12:56 PM, Urbani, Edmund  wrote:

> Hello all,
>
> is there an easy way to gain access to the Wicket session from within a
> Servlet? Preferably a way that works with any Wicket version starting from
> 1.4.
>
> Kind regards,
>  Edmund
> --
>
> Edmund Urbani
> Liland IT Team
>
> Email: edmund.urb...@lilandit.com 
>
> Liland IT GmbH ...does IT better
> Tel: +43 463 220111
> Fax: +43 463 220111-33
> Tel(GER): +49 221 65028588
>
> Find us at Facebook http://facebook.com/Lilandit
> http://green-badges.com
> http://iventcloud.com
> http://Lilandit.com
>
>  
>
> Copyright © 2016, Liland IT GmbH
>
> Diese Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
> Informationen.
> Wenn Sie nicht der richtige Adressat sind oder diese Email irrtuemlich
> erhalten haben, informieren Sie bitte sofort den Absender und vernichten
> Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe
> dieser Mail ist nicht gestattet.
>
> This email may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this email in
> error) please notify the sender immediately and destroy this email. Any
> unauthorised copying, disclosure or distribution of the material in this
> email is strictly forbidden.
>



-- 
Regards - Ernesto Reinaldo Barreiro


Accessing Wicket session from within a Servlet

2016-07-18 Thread Urbani, Edmund

Hello all,

is there an easy way to gain access to the Wicket session from within a Servlet? 
Preferably a way that works with any Wicket version starting from 1.4.


Kind regards,
 Edmund

--

Edmund Urbani
Liland IT Team

Email: edmund.urb...@lilandit.com 

Liland IT GmbH ...does IT better
Tel: +43 463 220111
Fax: +43 463 220111-33
Tel(GER): +49 221 65028588

Find us at Facebook http://facebook.com/Lilandit
http://green-badges.com
http://iventcloud.com
http://Lilandit.com

 

Copyright © 2016, Liland IT GmbH

Diese Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese Email irrtuemlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht 
gestattet.


This email may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this email in error) 
please notify the sender immediately and destroy this email. Any unauthorised 
copying, disclosure or distribution of the material in this email is strictly 
forbidden.




Re: Implications of setRecreateBookmarkablePagesAfterExpiry()

2016-07-18 Thread Ravi
Hi Martin,

Urls look good to me. All Ajax links point to 'page/param'.

Thank you.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Implications-of-setRecreateBookmarkablePagesAfterExpiry-tp4674899p4675132.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org