Re: How to get PageClass from BufferedResponseRequestHandler ? And how to link related requests?

2014-06-17 Thread Martin Grigorov
Hi,

You are correct!
It seems org.apache.wicket.response.filter.ServerAndClientTimeFilter and
the other similar filters lie because they use the current request cycle's
begin time. And as I said the processing time when there is a buffered
response should be quite small.
I agree that the reported time at the moment is not very useful.
It seems we need to store more information to/with BufferedWebResponse to
be able to cover the requirements in this mail thread and
https://issues.apache.org/jira/browse/WICKET-5129.

Please file a ticket.

Martin Grigorov
Wicket Training and Consulting


On Tue, Jun 17, 2014 at 2:04 AM, Hendy Irawan he...@soluvas.com wrote:

 It seems ignoring BufferedResponseRequestHandler is harder than I thought
 because IResponseFilter is only called during
 BufferedResponseRequestHandler, not during the preceding
 IPageRequestHandler.

 What is the best way to achieve my goal? i.e. during the begin and end of
 IPageRequestHandler I need to perform tasks
 (i.e. noting the start values, calculating the delta of values during
 request processing, and then manipulate the response).

 for begin and end we have RequestCycleListener.onRequestHandlerResolved and
 onEndRequest, but I don't know how to manipulate the response there (in
 onEndRequest)??

 The response manipulation is quite simple (adding dynamic JavaScripts
 before
 /body) but I'd like to do it in CPU-efficient way if possible.

 Hendy

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/How-to-get-PageClass-from-BufferedResponseRequestHandler-And-how-to-link-related-requests-tp4666247p4666282.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 get PageClass from BufferedResponseRequestHandler ? And how to link related requests?

2014-06-17 Thread Hendy Irawan
Thank you Martin!

Filed https://issues.apache.org/jira/browse/WICKET-5621

Hendy

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-get-PageClass-from-BufferedResponseRequestHandler-And-how-to-link-related-requests-tp4666247p4666286.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



How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
Hi,

I have a link (or ajax link) which executes some system command. This
system gives me an information if this command is enabled or not, so I
can mark my link as enabled or disabled (by calling
setEnabled(command.isEnabled()) or overriding link.isEnabled()
method).

1. Page is being rendered, command is enabled so link is rendered as enabled.
2. In the meantime system state is changed so command became disabled.
3. User clicks link on a page rendered in step 1 where link is
rendered as enabled but it is disabled now.

In Wicket 1.4 nothing happens in such situation and only warning was logged:
component not enabled or visible; ignoring call. Component:
[MarkupContainer [Component id = link]]

In Wicket 6 in such situation the exception is raised:
ListenerInvocationNotAllowedException: Behavior rejected interface invocation.

How should I handle this correctly to show some information to user,
that this is link is no longer active (but user should stay on the
same page)?
Should I catch ListenerInvocationNotAllowedException inside
IRequestCycleListener.onException()?

--
Daniel

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Martin Grigorov
Hi,


On Tue, Jun 17, 2014 at 4:55 PM, Daniel Stoch daniel.st...@gmail.com
wrote:

 Hi,

 I have a link (or ajax link) which executes some system command. This
 system gives me an information if this command is enabled or not, so I
 can mark my link as enabled or disabled (by calling
 setEnabled(command.isEnabled()) or overriding link.isEnabled()
 method).

 1. Page is being rendered, command is enabled so link is rendered as
 enabled.
 2. In the meantime system state is changed so command became disabled.
 3. User clicks link on a page rendered in step 1 where link is
 rendered as enabled but it is disabled now.

 In Wicket 1.4 nothing happens in such situation and only warning was
 logged:
 component not enabled or visible; ignoring call. Component:
 [MarkupContainer [Component id = link]]

 In Wicket 6 in such situation the exception is raised:
 ListenerInvocationNotAllowedException: Behavior rejected interface
 invocation.

 How should I handle this correctly to show some information to user,
 that this is link is no longer active (but user should stay on the
 same page)?
 Should I catch ListenerInvocationNotAllowedException inside
 IRequestCycleListener.onException()?


Yes. This is the best you can do in this case.



 --
 Daniel

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




Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Sven Meier

Hi,

when you alter the enabled state in #onConfigure() - this is recommended 
instead of overriding #isEnabled() - the link will still be enabled when 
the next click comes in.


You can handle the changed system state in your application logic.

Best regards
Sven

On 06/17/2014 03:55 PM, Daniel Stoch wrote:

Hi,

I have a link (or ajax link) which executes some system command. This
system gives me an information if this command is enabled or not, so I
can mark my link as enabled or disabled (by calling
setEnabled(command.isEnabled()) or overriding link.isEnabled()
method).

1. Page is being rendered, command is enabled so link is rendered as enabled.
2. In the meantime system state is changed so command became disabled.
3. User clicks link on a page rendered in step 1 where link is
rendered as enabled but it is disabled now.

In Wicket 1.4 nothing happens in such situation and only warning was logged:
component not enabled or visible; ignoring call. Component:
[MarkupContainer [Component id = link]]

In Wicket 6 in such situation the exception is raised:
ListenerInvocationNotAllowedException: Behavior rejected interface invocation.

How should I handle this correctly to show some information to user,
that this is link is no longer active (but user should stay on the
same page)?
Should I catch ListenerInvocationNotAllowedException inside
IRequestCycleListener.onException()?

--
Daniel

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




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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:14 PM, Sven Meier s...@meiers.net wrote:
 Hi,

 when you alter the enabled state in #onConfigure() - this is recommended
 instead of overriding #isEnabled() - the link will still be enabled when the
 next click comes in.

Hmmm, I think I don't understand :). The next click does not come
because exception is raised. If I catch exception and do nothing the
link is still enabled to user, because page is not rerendered,

 You can handle the changed system state in your application logic.

How?
The only solution I know is to auto-refresh a page (eg. using push),
but user can always click faster ;).


 Best regards
 Sven


 On 06/17/2014 03:55 PM, Daniel Stoch wrote:

 Hi,

 I have a link (or ajax link) which executes some system command. This
 system gives me an information if this command is enabled or not, so I
 can mark my link as enabled or disabled (by calling
 setEnabled(command.isEnabled()) or overriding link.isEnabled()
 method).

 1. Page is being rendered, command is enabled so link is rendered as
 enabled.
 2. In the meantime system state is changed so command became disabled.
 3. User clicks link on a page rendered in step 1 where link is
 rendered as enabled but it is disabled now.

 In Wicket 1.4 nothing happens in such situation and only warning was
 logged:
 component not enabled or visible; ignoring call. Component:
 [MarkupContainer [Component id = link]]

 In Wicket 6 in such situation the exception is raised:
 ListenerInvocationNotAllowedException: Behavior rejected interface
 invocation.

 How should I handle this correctly to show some information to user,
 that this is link is no longer active (but user should stay on the
 same page)?
 Should I catch ListenerInvocationNotAllowedException inside
 IRequestCycleListener.onException()?

 --
 Daniel

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



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


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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:00 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,


 On Tue, Jun 17, 2014 at 4:55 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 I have a link (or ajax link) which executes some system command. This
 system gives me an information if this command is enabled or not, so I
 can mark my link as enabled or disabled (by calling
 setEnabled(command.isEnabled()) or overriding link.isEnabled()
 method).

 1. Page is being rendered, command is enabled so link is rendered as
 enabled.
 2. In the meantime system state is changed so command became disabled.
 3. User clicks link on a page rendered in step 1 where link is
 rendered as enabled but it is disabled now.

 In Wicket 1.4 nothing happens in such situation and only warning was
 logged:
 component not enabled or visible; ignoring call. Component:
 [MarkupContainer [Component id = link]]

 In Wicket 6 in such situation the exception is raised:
 ListenerInvocationNotAllowedException: Behavior rejected interface
 invocation.

 How should I handle this correctly to show some information to user,
 that this is link is no longer active (but user should stay on the
 same page)?
 Should I catch ListenerInvocationNotAllowedException inside
 IRequestCycleListener.onException()?


 Yes. This is the best you can do in this case.


Thanks for very fast answer :)
But what should I return as a IRequestHandler in
IRequestCycleListener.onException()? I can return EmptyRequestHandler
to silently catch an exception, but if I want show some info to user
then...?

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Sven Meier

Hi,


The next click does not come because exception is raised.


if the link is still enabled, which exception should be thrown then?

Sven


On 06/17/2014 04:24 PM, Daniel Stoch wrote:

On Tue, Jun 17, 2014 at 4:14 PM, Sven Meier s...@meiers.net wrote:

Hi,

when you alter the enabled state in #onConfigure() - this is recommended
instead of overriding #isEnabled() - the link will still be enabled when the
next click comes in.

Hmmm, I think I don't understand :). The next click does not come
because exception is raised. If I catch exception and do nothing the
link is still enabled to user, because page is not rerendered,


You can handle the changed system state in your application logic.

How?
The only solution I know is to auto-refresh a page (eg. using push),
but user can always click faster ;).


Best regards
Sven


On 06/17/2014 03:55 PM, Daniel Stoch wrote:

Hi,

I have a link (or ajax link) which executes some system command. This
system gives me an information if this command is enabled or not, so I
can mark my link as enabled or disabled (by calling
setEnabled(command.isEnabled()) or overriding link.isEnabled()
method).

1. Page is being rendered, command is enabled so link is rendered as
enabled.
2. In the meantime system state is changed so command became disabled.
3. User clicks link on a page rendered in step 1 where link is
rendered as enabled but it is disabled now.

In Wicket 1.4 nothing happens in such situation and only warning was
logged:
component not enabled or visible; ignoring call. Component:
[MarkupContainer [Component id = link]]

In Wicket 6 in such situation the exception is raised:
ListenerInvocationNotAllowedException: Behavior rejected interface
invocation.

How should I handle this correctly to show some information to user,
that this is link is no longer active (but user should stay on the
same page)?
Should I catch ListenerInvocationNotAllowedException inside
IRequestCycleListener.onException()?

--
Daniel

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



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


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




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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:
 Hi,


 The next click does not come because exception is raised.


 if the link is still enabled, which exception should be thrown then?

 Sven


Please read again steps 1,2,3 ;).
Link is rendered as enabled in the browser (1), but on the server is
not enabled anymore (3).

--
Daniel

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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Martin Grigorov
On Tue, Jun 17, 2014 at 5:26 PM, Daniel Stoch daniel.st...@gmail.com
wrote:

 On Tue, Jun 17, 2014 at 4:00 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
 
  On Tue, Jun 17, 2014 at 4:55 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  I have a link (or ajax link) which executes some system command. This
  system gives me an information if this command is enabled or not, so I
  can mark my link as enabled or disabled (by calling
  setEnabled(command.isEnabled()) or overriding link.isEnabled()
  method).
 
  1. Page is being rendered, command is enabled so link is rendered as
  enabled.
  2. In the meantime system state is changed so command became disabled.
  3. User clicks link on a page rendered in step 1 where link is
  rendered as enabled but it is disabled now.
 
  In Wicket 1.4 nothing happens in such situation and only warning was
  logged:
  component not enabled or visible; ignoring call. Component:
  [MarkupContainer [Component id = link]]
 
  In Wicket 6 in such situation the exception is raised:
  ListenerInvocationNotAllowedException: Behavior rejected interface
  invocation.
 
  How should I handle this correctly to show some information to user,
  that this is link is no longer active (but user should stay on the
  same page)?
  Should I catch ListenerInvocationNotAllowedException inside
  IRequestCycleListener.onException()?
 
 
  Yes. This is the best you can do in this case.
 

 Thanks for very fast answer :)
 But what should I return as a IRequestHandler in
 IRequestCycleListener.onException()? I can return EmptyRequestHandler
 to silently catch an exception, but if I want show some info to user
 then...?



page.warning(...); // see
PageRequestHandlerTracker#getFirstHandler(cycle).getPage();
AjaxRequestTarget target = requestCycle.find(AjaxRequestTarget.class);
if (target != null) {
  target.addChildren(page, IFeedback.class);
  return target;
} else {
  return new RenderPageRequestHandler(new PageProvider(page));
}



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




Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Sven Meier
If you alter the enabled state of your links in #onConfigure(), they 
will still be enabled - even if the server state already changed.


Sven

On 06/17/2014 04:32 PM, Daniel Stoch wrote:

On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:

Hi,



The next click does not come because exception is raised.


if the link is still enabled, which exception should be thrown then?

Sven


Please read again steps 1,2,3 ;).
Link is rendered as enabled in the browser (1), but on the server is
not enabled anymore (3).

--
Daniel

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




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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Sven Meier

Background information:

http://apache-wicket.1842946.n4.nabble.com/vote-release-Wicket-1-4-14-tp3056628p3063795.html
http://wicketinaction.com/2011/11/implement-wicket-component-visibility-changes-properly/

Sven


On 06/17/2014 05:15 PM, Daniel Stoch wrote:

On Tue, Jun 17, 2014 at 5:08 PM, Sven Meier s...@meiers.net wrote:

If you alter the enabled state of your links in #onConfigure(), they will
still be enabled - even if the server state already changed.

Sven

Yes, you're right!

I have investigated two scenarios just before your last answer :).
1. Link has overriden isEnabled() - then
ListenerInvocationNotAllowedException is when command is not (as I
described in my first post).
2. The enabled state of links are altered in #onConfigure() - link is
still enabled even if the server state already changed. So we must do
an extra check in onClick() method.

So now I try to use the second solution (I have an abstraction over
all links so it would be easy to implement) and add an extra check
before calling a link code.
Thanks for your help.

--
Daniel




On 06/17/2014 04:32 PM, Daniel Stoch wrote:

On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:

Hi,



The next click does not come because exception is raised.


if the link is still enabled, which exception should be thrown then?

Sven


Please read again steps 1,2,3 ;).
Link is rendered as enabled in the browser (1), but on the server is
not enabled anymore (3).

--
Daniel

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



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


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




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



Re: How to handle click on disabled links - ListenerInvocationNotAllowedException?

2014-06-17 Thread Daniel Stoch
On Tue, Jun 17, 2014 at 5:08 PM, Sven Meier s...@meiers.net wrote:
 If you alter the enabled state of your links in #onConfigure(), they will
 still be enabled - even if the server state already changed.

 Sven

Yes, you're right!

I have investigated two scenarios just before your last answer :).
1. Link has overriden isEnabled() - then
ListenerInvocationNotAllowedException is when command is not (as I
described in my first post).
2. The enabled state of links are altered in #onConfigure() - link is
still enabled even if the server state already changed. So we must do
an extra check in onClick() method.

So now I try to use the second solution (I have an abstraction over
all links so it would be easy to implement) and add an extra check
before calling a link code.
Thanks for your help.

--
Daniel




 On 06/17/2014 04:32 PM, Daniel Stoch wrote:

 On Tue, Jun 17, 2014 at 4:27 PM, Sven Meier s...@meiers.net wrote:

 Hi,


 The next click does not come because exception is raised.


 if the link is still enabled, which exception should be thrown then?

 Sven

 Please read again steps 1,2,3 ;).
 Link is rendered as enabled in the browser (1), but on the server is
 not enabled anymore (3).

 --
 Daniel

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



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


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



Submiting form on a stateless page creates form page twice

2014-06-17 Thread KotFilemon
Hello

I used wicket to create small web application with search page. This page is
called many times in single minute, that is why we use stateless page for
smaller memory usage. On this page is stateless form with query text field
and after submit user is redirected to the same page with different page
parameters (setResponsePage(clazz,pageParameters);). We noticed that when
user clicked submit button wicket generate this page with old parameters,
then run osSubmit method and later generate this page with new parameters,
what call twice our search engine for the results! This is the normal
situation? Is any way to deal with this behaviour?

Best regards
KotFilemon 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Submiting-form-on-a-stateless-page-creates-form-page-twice-tp4666301.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: Ajax Form Submit via jquery plugin / javascript

2014-06-17 Thread Paul Bors
Instead of calling form.submit() from your jQuery, call 
${‘#someButtonID’}.click() or whatever, then register your event under the 
button’s onClick in Wicket.
You can have that button shared, or you can write your own Behavior to submit 
the form via a hidden button (i.e.: X and Y coordinates set to negative so it’s 
way off the page as well as its display property set to hidden).

Those are just couple of ideas.

On Jun 13, 2014, at 11:45 AM, vp143 vishal.po...@cipriati.co.uk wrote:

 Paul Bors wrote
 http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.html
 
 Ajax event behavior that submits a form via ajax when the event it is
 attached to, is invoked.”
 
 You’re attaching the submit event so who fires that?
 
 You are right, I missed that but I am still a little stumped on what to do.
 
 I am assuming the form gets submitted when calling 
 jQuery(#selectionForm).submit()
 
 I was assuming this part
 add(new AjaxFormSubmitBehavior(this, onsubmit) { 
 would be waiting for the submit of the form and then get executed.
 
 Have I understood correctly?
 What am I missing?
 
 Regards
 Vishal
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Ajax-Form-Submit-via-jquery-plugin-javascript-tp4666170p4666257.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
 


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