Re: Wicket 8 and servlet 3.1 async nio

2017-02-15 Thread Martin Grigorov
On Wed, Feb 15, 2017 at 10:29 PM, guillaume.mary 
wrote:

> Martin Grigorov-4 wrote
> > On Wed, Feb 15, 2017 at 9:41 PM, guillaume.mary 
>
> > guiom.mary@
>
> > 
> > wrote:
> >
> >> Martin Grigorov-4 wrote
> >> > Hi,
> >> >
> >> >>
> >> >> Did I miss something ? if not is there anything planned about async
> IO
> >> in
> >> >> Wicket 8 ?
> >> >>
> >> >
> >> > There is no planned support for asynchronous pages for Wicket 8!
> >>
> >> Is there some technical (known) reason ? Or just because of roadmap
> >> decision
> >> ?
> >> I mean, if i have some time can I try to implement it or does it have
> >> some
> >> technical hard difficulties ?
> >>
> >> Did anyone already try and didn't manage to do it ?
> >>
> >
> > AFAIK no one tried.
> >
> > In what use cases it would be helpful ?
> >
> > Imagine the following:
> > 1) the user clicks a link
> > 2) onClick() is fired
> > 2.1) some slow operation is started in the background
> > 2.2) the request is suspended
> > 2.3) the slow operation produces a result
> > 3) how exaclty the resume will execute the rest of the body of onClick()
> > to
> > finish the business logic and then re-render (parts of) the page ?
>
> I wasn't thinking to such a scenario, I agree this is complex to implement.
> I though to the final "push" into the OutputStream of the ServletResponse.
> I
> though that Wicket buffers its response into memory before writing it to
> the
> stream, this could be done asynchronously. But I'm maybe wrong. If this
> could be done it would help the server because at such a moment there's no
> more business logic to be done by the application.
> But maybe Wicket also has work (Thread dependent) to do after that ?
>

I am not sure how good such change will be!
If the content is already prepared then it would be better just to flush it
in the current thread. Otherwise the context switch and the scheduling will
delay the write, so the complete request cycle time will be bigger than now.

The asynchronous servlets are useful if your logic needs to block on some
external resource. While waiting for the external resource it is better to
release the http worker thread so the web server can handle another request
with it. Once the external resource is available asyncContext.dispatch()
will request a new http worker thread. Once the web server has an available
thread it will use it to actually do the dispatch.


>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Wicket-8-and-servlet-3-1-async-nio-tp4677098p4677126.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
>
>


Re: Wicket 8 and servlet 3.1 async nio

2017-02-15 Thread guillaume.mary
Martin Grigorov-4 wrote
> On Wed, Feb 15, 2017 at 9:41 PM, guillaume.mary 

> guiom.mary@

> 
> wrote:
> 
>> Martin Grigorov-4 wrote
>> > Hi,
>> >
>> >>
>> >> Did I miss something ? if not is there anything planned about async IO
>> in
>> >> Wicket 8 ?
>> >>
>> >
>> > There is no planned support for asynchronous pages for Wicket 8!
>>
>> Is there some technical (known) reason ? Or just because of roadmap
>> decision
>> ?
>> I mean, if i have some time can I try to implement it or does it have
>> some
>> technical hard difficulties ?
>>
>> Did anyone already try and didn't manage to do it ?
>>
> 
> AFAIK no one tried.
> 
> In what use cases it would be helpful ?
> 
> Imagine the following:
> 1) the user clicks a link
> 2) onClick() is fired
> 2.1) some slow operation is started in the background
> 2.2) the request is suspended
> 2.3) the slow operation produces a result
> 3) how exaclty the resume will execute the rest of the body of onClick()
> to
> finish the business logic and then re-render (parts of) the page ?

I wasn't thinking to such a scenario, I agree this is complex to implement.
I though to the final "push" into the OutputStream of the ServletResponse. I
though that Wicket buffers its response into memory before writing it to the
stream, this could be done asynchronously. But I'm maybe wrong. If this
could be done it would help the server because at such a moment there's no
more business logic to be done by the application.
But maybe Wicket also has work (Thread dependent) to do after that ?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-8-and-servlet-3-1-async-nio-tp4677098p4677126.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



Re: AjaxSubmitLink not working

2017-02-15 Thread Richard W. Adams
This may not be the issue, but it's good practice to always include an 
onError method in the anonymous class. Once you add that, put a break 
point there & see what turns up.



From:   Entropy 
To: users@wicket.apache.org
Date:   02/15/2017 11:55 AM
Subject:AjaxSubmitLink not working



This email originated from outside of the company.  Please use discretion 
if opening attachments or clicking on links.

I have a header links section in my header that must build in a dynamic 
way. 

 AjaxSubmitLink link = new 
AjaxSubmitLink(linkName, formToSubmit) {
 @Override
 public void 
onSubmit(AjaxRequestTarget target, Form form) {
//control never gets here.
 }
 };

That is being built in a function call that is called from a loop (though 
I
don't think that matters).  The HTML (of one example):

li wicket:id="contactLi"a wicket:id="contactLink"
href="/contact"Contact Information/a/li

In the wicket ajax debug window, I am getting this:

INFO: focus removed from 

INFO: focus set on startLinkc

INFO: Received ajax response (69 characters)

INFO: 


INFO: Response processed successfully.

INFO: refocus last focused component not needed/allowed

Implying that it ran, but did nothing?  There are no validators in place
(yet) on the form.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-not-working-tp4677120.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






**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Wicket 8 and servlet 3.1 async nio

2017-02-15 Thread Martin Grigorov
On Wed, Feb 15, 2017 at 9:41 PM, guillaume.mary 
wrote:

> Martin Grigorov-4 wrote
> > Hi,
> >
> >>
> >> Did I miss something ? if not is there anything planned about async IO
> in
> >> Wicket 8 ?
> >>
> >
> > There is no planned support for asynchronous pages for Wicket 8!
>
> Is there some technical (known) reason ? Or just because of roadmap
> decision
> ?
> I mean, if i have some time can I try to implement it or does it have some
> technical hard difficulties ?
>
> Did anyone already try and didn't manage to do it ?
>

AFAIK no one tried.

In what use cases it would be helpful ?

Imagine the following:
1) the user clicks a link
2) onClick() is fired
2.1) some slow operation is started in the background
2.2) the request is suspended
2.3) the slow operation produces a result
3) how exaclty the resume will execute the rest of the body of onClick() to
finish the business logic and then re-render (parts of) the page ?


>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Wicket-8-and-servlet-3-1-async-nio-tp4677098p4677123.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
>
>


Re: Wicket 8 and servlet 3.1 async nio

2017-02-15 Thread guillaume.mary
Martin Grigorov-4 wrote
> Hi,
> 
>>
>> Did I miss something ? if not is there anything planned about async IO in
>> Wicket 8 ?
>>
> 
> There is no planned support for asynchronous pages for Wicket 8!

Is there some technical (known) reason ? Or just because of roadmap decision
?
I mean, if i have some time can I try to implement it or does it have some
technical hard difficulties ?

Did anyone already try and didn't manage to do it ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-8-and-servlet-3-1-async-nio-tp4677098p4677123.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



Re: AjaxSubmitLink not working

2017-02-15 Thread Entropy
Okay, I just did.  Control does not get there either.  BTW, if onError is
something we should always override, perhaps it should be abstract?

Still mystified

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-not-working-tp4677120p4677122.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



Re: AjaxSubmitLink not working

2017-02-15 Thread Martin Grigorov
On Wed, Feb 15, 2017 at 6:51 PM, Entropy  wrote:

> I have a header links section in my header that must build in a dynamic
> way.
>
> AjaxSubmitLink link = new AjaxSubmitLink(linkName,
> formToSubmit) {
> @Override
> public void onSubmit(AjaxRequestTarget target,
> Form form) {
> //control never gets here.
> }
>

Always override #onError() too !


> };
>
> That is being built in a function call that is called from a loop (though I
> don't think that matters).  The HTML (of one example):
>
> li wicket:id="contactLi"a wicket:id="contactLink"
> href="/contact"Contact Information/a/li
>
> In the wicket ajax debug window, I am getting this:
>
> INFO: focus removed from
>
> INFO: focus set on startLinkc
>
> INFO: Received ajax response (69 characters)
>
> INFO:
> 
>
> INFO: Response processed successfully.
>
> INFO: refocus last focused component not needed/allowed
>
> Implying that it ran, but did nothing?  There are no validators in place
> (yet) on the form.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxSubmitLink-not-working-tp4677120.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
>
>


AjaxSubmitLink not working

2017-02-15 Thread Entropy
I have a header links section in my header that must build in a dynamic way.  

AjaxSubmitLink link = new AjaxSubmitLink(linkName, 
formToSubmit) {
@Override
public void onSubmit(AjaxRequestTarget target, Form 
form) {
//control never gets here.
}
};

That is being built in a function call that is called from a loop (though I
don't think that matters).  The HTML (of one example):

li wicket:id="contactLi"a wicket:id="contactLink"
href="/contact"Contact Information/a/li

In the wicket ajax debug window, I am getting this:

INFO: focus removed from 

INFO: focus set on startLinkc

INFO: Received ajax response (69 characters)

INFO: 


INFO: Response processed successfully.

INFO: refocus last focused component not needed/allowed

Implying that it ran, but did nothing?  There are no validators in place
(yet) on the form.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-not-working-tp4677120.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



Re: How to do this in wicket

2017-02-15 Thread Entropy
Ha, yeah.  I forgot about that.  I implemented a solution based on that
thread (not exactly the same) but then a bit later it turned out to cause
problems for our web designer, hence me being back.  I ended up using
renderHead() to put out exactly what the web designer needed in the
delivered HTML, yet with only the one HTML tag in the template so that the
parser would work.  So this is resolved for me.

Thanks for everyone's quick responses.  

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-do-this-in-wicket-tp4677103p4677119.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



Re: Safe way to display HTML user input

2017-02-15 Thread Martin Grigorov
For the history here is library:
https://github.com/owasp/java-html-sanitizer

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

On Thu, Feb 9, 2017 at 11:28 PM, daniel simko  wrote:

> Thank you Martin! This is exactly what I was looking for.
>
> 2017-02-09 13:03 GMT+01:00 Martin Grigorov :
>
> > Hi,
> >
> > Check https://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Thu, Feb 9, 2017 at 12:50 PM, daniel simko 
> wrote:
> >
> > > Hello,
> > >
> > > I would like to ask you whether there is some safe way how to display
> > html
> > > output from some rich editor (e.g. TinyMCE)? In order to display html
> it
> > is
> > > necessary to switch off model escaping [1] which is opening a door for
> > XSS.
> > > I was thinking about some converter [2] which would escape only JS
> > related
> > > stuff (e.g.