Re: Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
Thanks for the reply. Could you possibly provide an insight on the solution below? http://stackoverflow.com/a/8667136/248082 Actually, my problem is the same. As also a comment mentioned there, after 6.13, the custom mount mapper does not work properly any more. Thanks, Behrooz On Thu, Jul 31, 2014 at 5:03 PM, Martin Grigorov mgrigo...@apache.org wrote: On Jul 31, 2014 12:30 AM, Behrooz Nobakht nob...@gmail.com wrote: Thanks for the hint. It seems that we had a custom MountedMapper with the following specifics: @Override protected void encodePageComponentInfo(Url url, PageComponentInfo info) { // do nothing so that component info does not get // rendered in url } @Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof ListenerInterfaceRequestHandler) { You need to check for BookmarkableListenerInterfaceRequestHandler too return null; } else { return super.mapHandler(requestHandler); } } I could not figure why this corrupted the callback URLs in the end but when I replaced them with the default one, the issue was resolved. Any idea to understand this better? Thanks, Behrooz On Wed, Jul 30, 2014 at 10:28 PM, Sven Meier s...@meiers.net wrote: Hi, u:./controllers that cannot be a valid url for an ajaxBehavior. You'll have to put a breakpoint in AbstractAjaxBehavior#getCallbackUrl() and see where the url is coming from. Regards Sven On 07/30/2014 10:04 PM, Behrooz Nobakht wrote: I tracked down the difference. When using 6.12.0, the HTML source of the page shows: Wicket.Ajax.ajax({u:./wicket/page?3-1.IBehaviorListener.1-table- form-url,e:change,c:url49,ad:true,m:POST}); for the URL textfield that I use the AjaxFormCompnentUpdatingBehavior. However, from 6.13.0, instead the following is generated: Wicket.Ajax.ajax({u:./controllers,e:change,c: url42,ad:true,m:POST}); which is different from above. Note that my page is a mounted page at path /controllers. The “u” field is the callback URL generated by the behavior. How should I fix this? Thanks, Behrooz On Wed, Jul 30, 2014 at 7:59 PM, Sven Meier s...@meiers.net wrote: Hi, it works fine here with a small example. Please create a quickstart and attach it to a jira issue. Thanks Sven On 07/30/2014 07:42 PM, Behrooz Nobakht wrote: Yes, I've tried all from 6.13.0 to 6.16.0 and the issue is the same. Thanks, Behrooz On Wed, Jul 30, 2014 at 7:32 PM, Sven Meier s...@meiers.net wrote: Have you tried 6.16.0? Regards Sven On 07/30/2014 07:11 PM, Behrooz Nobakht wrote: Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz - 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 -- -- Behrooz Nobakht -- -- Behrooz Nobakht
Re: Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
Apologies from me if the question was not clear. Let me recap in a couple of items: - From 6.12 to 6.13, something changed. This change requires to also check for BookmarkableListenerInterfaceRequestHandler in the custom MountedMapper. Is this change having other side effects? Is it documented to study more in depth? - From a higher level, what is the best practice to remove “version” from page URLs? Thanks, Behrooz On Sat, Aug 9, 2014 at 6:40 PM, Martin Grigorov mgrigo...@apache.org wrote: Sorry.I didn't get what I'm supposed to do. Did you apply my suggestion ? I see the code at http://stackoverflow.com/a/8667136/248082 is OK. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Sat, Aug 9, 2014 at 6:15 PM, Behrooz Nobakht nob...@gmail.com wrote: Thanks for the reply. Could you possibly provide an insight on the solution below? http://stackoverflow.com/a/8667136/248082 Actually, my problem is the same. As also a comment mentioned there, after 6.13, the custom mount mapper does not work properly any more. Thanks, Behrooz On Thu, Jul 31, 2014 at 5:03 PM, Martin Grigorov mgrigo...@apache.org wrote: On Jul 31, 2014 12:30 AM, Behrooz Nobakht nob...@gmail.com wrote: Thanks for the hint. It seems that we had a custom MountedMapper with the following specifics: @Override protected void encodePageComponentInfo(Url url, PageComponentInfo info) { // do nothing so that component info does not get // rendered in url } @Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof ListenerInterfaceRequestHandler) { You need to check for BookmarkableListenerInterfaceRequestHandler too return null; } else { return super.mapHandler(requestHandler); } } I could not figure why this corrupted the callback URLs in the end but when I replaced them with the default one, the issue was resolved. Any idea to understand this better? Thanks, Behrooz On Wed, Jul 30, 2014 at 10:28 PM, Sven Meier s...@meiers.net wrote: Hi, u:./controllers that cannot be a valid url for an ajaxBehavior. You'll have to put a breakpoint in AbstractAjaxBehavior#getCallbackUrl() and see where the url is coming from. Regards Sven On 07/30/2014 10:04 PM, Behrooz Nobakht wrote: I tracked down the difference. When using 6.12.0, the HTML source of the page shows: Wicket.Ajax.ajax({u:./wicket/page?3-1.IBehaviorListener.1-table- form-url,e:change,c:url49,ad:true,m:POST}); for the URL textfield that I use the AjaxFormCompnentUpdatingBehavior. However, from 6.13.0, instead the following is generated: Wicket.Ajax.ajax({u:./controllers,e:change,c: url42,ad:true,m:POST}); which is different from above. Note that my page is a mounted page at path /controllers. The “u” field is the callback URL generated by the behavior. How should I fix this? Thanks, Behrooz On Wed, Jul 30, 2014 at 7:59 PM, Sven Meier s...@meiers.net wrote: Hi, it works fine here with a small example. Please create a quickstart and attach it to a jira issue. Thanks Sven On 07/30/2014 07:42 PM, Behrooz Nobakht wrote: Yes, I've tried all from 6.13.0 to 6.16.0 and the issue is the same. Thanks, Behrooz On Wed, Jul 30, 2014 at 7:32 PM, Sven Meier s...@meiers.net wrote: Have you tried 6.16.0? Regards Sven On 07/30/2014 07:11 PM, Behrooz Nobakht wrote: Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz
Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz -- -- Behrooz Nobakht
Re: Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
Yes, I've tried all from 6.13.0 to 6.16.0 and the issue is the same. Thanks, Behrooz On Wed, Jul 30, 2014 at 7:32 PM, Sven Meier s...@meiers.net wrote: Have you tried 6.16.0? Regards Sven On 07/30/2014 07:11 PM, Behrooz Nobakht wrote: Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- -- Behrooz Nobakht
Re: Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
I tracked down the difference. When using 6.12.0, the HTML source of the page shows: Wicket.Ajax.ajax({u:./wicket/page?3-1.IBehaviorListener.1-table-form-url,e:change,c:url49,ad:true,m:POST}); for the URL textfield that I use the AjaxFormCompnentUpdatingBehavior. However, from 6.13.0, instead the following is generated: Wicket.Ajax.ajax({u:./controllers,e:change,c:url42,ad:true,m:POST}); which is different from above. Note that my page is a mounted page at path /controllers. The “u” field is the callback URL generated by the behavior. How should I fix this? Thanks, Behrooz On Wed, Jul 30, 2014 at 7:59 PM, Sven Meier s...@meiers.net wrote: Hi, it works fine here with a small example. Please create a quickstart and attach it to a jira issue. Thanks Sven On 07/30/2014 07:42 PM, Behrooz Nobakht wrote: Yes, I've tried all from 6.13.0 to 6.16.0 and the issue is the same. Thanks, Behrooz On Wed, Jul 30, 2014 at 7:32 PM, Sven Meier s...@meiers.net wrote: Have you tried 6.16.0? Regards Sven On 07/30/2014 07:11 PM, Behrooz Nobakht wrote: Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz - 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 -- -- Behrooz Nobakht
Re: Upgrade to 6.12.0+ with AjaxFormComponentUpdatingBehavior reloads the page
Thanks for the hint. It seems that we had a custom MountedMapper with the following specifics: @Override protected void encodePageComponentInfo(Url url, PageComponentInfo info) { // do nothing so that component info does not get // rendered in url } @Override public Url mapHandler(IRequestHandler requestHandler) { if (requestHandler instanceof ListenerInterfaceRequestHandler) { return null; } else { return super.mapHandler(requestHandler); } } I could not figure why this corrupted the callback URLs in the end but when I replaced them with the default one, the issue was resolved. Any idea to understand this better? Thanks, Behrooz On Wed, Jul 30, 2014 at 10:28 PM, Sven Meier s...@meiers.net wrote: Hi, u:./controllers that cannot be a valid url for an ajaxBehavior. You'll have to put a breakpoint in AbstractAjaxBehavior#getCallbackUrl() and see where the url is coming from. Regards Sven On 07/30/2014 10:04 PM, Behrooz Nobakht wrote: I tracked down the difference. When using 6.12.0, the HTML source of the page shows: Wicket.Ajax.ajax({u:./wicket/page?3-1.IBehaviorListener.1-table- form-url,e:change,c:url49,ad:true,m:POST}); for the URL textfield that I use the AjaxFormCompnentUpdatingBehavior. However, from 6.13.0, instead the following is generated: Wicket.Ajax.ajax({u:./controllers,e:change,c: url42,ad:true,m:POST}); which is different from above. Note that my page is a mounted page at path /controllers. The “u” field is the callback URL generated by the behavior. How should I fix this? Thanks, Behrooz On Wed, Jul 30, 2014 at 7:59 PM, Sven Meier s...@meiers.net wrote: Hi, it works fine here with a small example. Please create a quickstart and attach it to a jira issue. Thanks Sven On 07/30/2014 07:42 PM, Behrooz Nobakht wrote: Yes, I've tried all from 6.13.0 to 6.16.0 and the issue is the same. Thanks, Behrooz On Wed, Jul 30, 2014 at 7:32 PM, Sven Meier s...@meiers.net wrote: Have you tried 6.16.0? Regards Sven On 07/30/2014 07:11 PM, Behrooz Nobakht wrote: Hi, I just upgraded an Apache Wicket application from 6.12.0 to 6.13.0 with a page including form with the following component: ``` textfield.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(button); String validationMessage = validateModel(model); if (validationMessage != null) { addErrorMessage(target, feedback, validationMessage); button.setEnabled(false); return; } button.setEnabled(true); } }); ``` With 6.13.0, when I write something in the textfield and then press a tab (go to next field), the page automatically gets reloaded. Is this a known issue? What am I missing? Thanks in advance, Behrooz - 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 -- -- Behrooz Nobakht
Decide if a page is expired or the user is inactive in AJAX settings?
Hello, Let's assume that I have a page that has a set of components. Many of the components use automatic AJAX update behavior to pull changes and refresh themselves in the page. Additionally, I use a custom version of AjaxSelfUpdatingBehavior in which if the page is not changed in a maximum timeout, it automatically displays a modal to the user and stops all the automatic AJAX updates of the components above. However, this approach has a bug: if the user continues to work on the same page and operates some AJAX actions, the expiration modal is displayed, however, logically, this should not happen because the user was active on the page but using the AJAX features. Notice, when the user works with one AJAX component, such activity is not visible to all the components and the behavior that controls expiration timeout. So, the general question is that how to detect if the user has been inactive on a page that uses components with AJAX self updating behavior? i.e. the page should be expired if *none* of the components and the page itself receive *no* activity from the user. Is there a standard Wicket way to do this? Thanks in advance for your discussions and ideas. Regards, Behrooz Nobakht
AjaxSelfUpdatingTimerBehavior does not stop itself properly after certain time
Hello, I have a custom AjaxSelfUpdatingTimerBehavior as follows: public class LimitedAjaxSelfUpdatingTimerBehavior extends AjaxSelfUpdatingTimerBehavior { private static final long serialVersionUID = 1L; public static final long MAX_IDLE_TIME = TimeUnit.SECONDS.toMillis(120); private final Logger logger = LoggerFactory.getLogger(getClass()); private final AtomicLong createdTime = new AtomicLong(System.currentTimeMillis()); private final AtomicBoolean expired = new AtomicBoolean(false); public LimitedAjaxSelfUpdatingTimerBehavior() { this(Duration.milliseconds(MAX_IDLE_TIME)); } protected LimitedAjaxSelfUpdatingTimerBehavior(Duration updateInterval) { super(updateInterval); } @Override protected final void onPostProcessTarget(AjaxRequestTarget target) { if (expired.get()) { stop(target); return; } doProcessTarget(target); } @Override protected boolean shouldTrigger() { long idle = System.currentTimeMillis() - createdTime.get(); expired.compareAndSet(false, idle MAX_IDLE_TIME); if (expired.get()) { logger.warn(A message); // find the AJAX request and stop it AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); stop(target); } return !expired.get(); } /** * @param target */ protected void doProcessTarget(AjaxRequestTarget target) { } } I use this behavior on a set of my components in a Wicket page, however, after the default timeout passes, I can still see in the browser debug console XHR requests such as: http://localhost:8081/w/wicket/page?1-1.IBehaviorListener.0-serviceInstances-0-serviceInstanceServerInstances-content-servers-0-server-instances-0-instance_=1380542862344 And the response to such XHR looks like: ajax-response evaluate encoding=wicket1 ![CDATA[ (function(){Wicket.TimerHandles['instance103']^ = setTimeout('Wicket.Ajax.ajax({\u\:\./page?1-1.IBehaviorListener.0-serviceInstances-0-serviceInstanceServerInstances-content-servers-0-server-instances-0-instance\,\c\:\instance103\});', 1)})(); ]] /evaluate /ajax-response which shows that the behavior has *not* been stopped for the component. What am I missing or doing in a wrong way? Thanks for the help!— Behrooz Nobakht
Re: AjaxSelfUpdatingTimerBehavior does not stop itself properly after certain time
Thanks for the hint. The part that delete Wicket.TimerHandles[‘instance103’] should be in the response, helped us find the issue. However, there is a more general discussion as this cannot be called a bug. Why after the last time “shouldTrigger” is called and then “stop(AjaxRequestTargte)”, there will be still another call to “doProcessTarget()”? This made us to use two flags to manage time-wise expiration of the behavior. Thanks, On Mon, Sep 30, 2013 at 2:23 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Put a breakpoint in #onPostProcessTarget() and make sure that stop(target) is invoked. Then check the Ajax response for this request and verify that it has something like: delete Wicket.TimerHandles['instance103'] and that there is no another setTimeout() call in the evaluation elements in the response. As last resort create a quickstart app and attach it to a ticket so we can debug it and fix it if there is a problem. On Mon, Sep 30, 2013 at 2:12 PM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I have a custom AjaxSelfUpdatingTimerBehavior as follows: public class LimitedAjaxSelfUpdatingTimerBehavior extends AjaxSelfUpdatingTimerBehavior { private static final long serialVersionUID = 1L; public static final long MAX_IDLE_TIME = TimeUnit.SECONDS.toMillis(120); private final Logger logger = LoggerFactory.getLogger(getClass()); private final AtomicLong createdTime = new AtomicLong(System.currentTimeMillis()); private final AtomicBoolean expired = new AtomicBoolean(false); public LimitedAjaxSelfUpdatingTimerBehavior() { this(Duration.milliseconds(MAX_IDLE_TIME)); } protected LimitedAjaxSelfUpdatingTimerBehavior(Duration updateInterval) { super(updateInterval); } @Override protected final void onPostProcessTarget(AjaxRequestTarget target) { if (expired.get()) { stop(target); return; } doProcessTarget(target); } @Override protected boolean shouldTrigger() { long idle = System.currentTimeMillis() - createdTime.get(); expired.compareAndSet(false, idle MAX_IDLE_TIME); if (expired.get()) { logger.warn(A message); // find the AJAX request and stop it AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); stop(target); } return !expired.get(); } /** * @param target */ protected void doProcessTarget(AjaxRequestTarget target) { } } I use this behavior on a set of my components in a Wicket page, however, after the default timeout passes, I can still see in the browser debug console XHR requests such as: http://localhost:8081/w/wicket/page?1-1.IBehaviorListener.0-serviceInstances-0-serviceInstanceServerInstances-content-servers-0-server-instances-0-instance_=1380542862344 And the response to such XHR looks like: ajax-response evaluate encoding=wicket1 ![CDATA[ (function(){Wicket.TimerHandles['instance103']^ = setTimeout('Wicket.Ajax.ajax({\u\:\./page?1-1.IBehaviorListener.0-serviceInstances-0-serviceInstanceServerInstances-content-servers-0-server-instances-0-instance\,\c\:\instance103\});', 1)})(); ]] /evaluate /ajax-response which shows that the behavior has *not* been stopped for the component. What am I missing or doing in a wrong way? Thanks for the help!— Behrooz Nobakht -- -- Behrooz Nobakht
Question regarding exceptions in Apache Wicket
Hello, I've been working on an error page in Apache Wicket and came across a general pattern in Apache Wicket and I'd like to understand the reason for it. Exceptions in Apache Wicket do not have a single class hierarchy; i.e. there are exceptions that eventually extend WicketRuntimeException but they are also many others that start either from RuntimeException or Exception. I could guess for the reasons for checked exceptions but why did *not* Apache Wicket introduce exception classes that all inherit from a single exception class? A direct side effect of this design decision is that the check (e instanceof WicketRuntimeException) cannot give an indication if the exception is actually an exception raised by Wicket and need separate checks for different concerns. Thanks in advance for your explanations. Regards, Behrooz
Re: Question regarding exceptions in Apache Wicket
More clearly, the intention is to be able to distinguish exceptions from Apache Wicket and other frameworks and not really handle them. For instance, there can be two exceptions: MarkupException and CouldNotLockPageException. Both are in the context of Apache Wicket, however, we actually need to two checks to determine either. If they inherited a common parent class, it needed one check. I do not want to say that Apache Wicket should have done this. I first want to understand why this design decision has been made. On Wed, May 1, 2013 at 10:04 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: what is the purpose of knowing whether an exception is a wicket exception or something from further down the stack? eg how would you handle a runtime exception that came from within java.lang.String differently then the one that came from Wicket or the one that came from the servlet api? -igor On Wed, May 1, 2013 at 12:23 AM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I've been working on an error page in Apache Wicket and came across a general pattern in Apache Wicket and I'd like to understand the reason for it. Exceptions in Apache Wicket do not have a single class hierarchy; i.e. there are exceptions that eventually extend WicketRuntimeException but they are also many others that start either from RuntimeException or Exception. I could guess for the reasons for checked exceptions but why did *not* Apache Wicket introduce exception classes that all inherit from a single exception class? A direct side effect of this design decision is that the check (e instanceof WicketRuntimeException) cannot give an indication if the exception is actually an exception raised by Wicket and need separate checks for different concerns. Thanks in advance for your explanations. Regards, Behrooz - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- -- Behrooz Nobakht
Re: Question regarding exceptions in Apache Wicket
Thanks for the reply. The purpose is that when it's determined that exception comes from Wicket, the error page (1) can reduce the cause chain (which can be independent of Apache Wicket of course), and (2) based on this information provide the user to report a bug or email the stack trace to a set of stack holders. That's why I was thinking using instanceof as less as possible is more preferred and indeed cleaner instead of checking package names. I generally agree that this could be done independent of how Apache Wicket exceptions are designed and it's more categorized in the convenience zone. On Wed, May 1, 2013 at 11:06 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote: On Wed, May 1, 2013 at 1:23 AM, Behrooz Nobakht nob...@gmail.com wrote: More clearly, the intention is to be able to distinguish exceptions from Apache Wicket and other frameworks and not really handle them. for what purpose? an unhandled exception is an unhandled exception... For instance, there can be two exceptions: MarkupException and CouldNotLockPageException. Both are in the context of Apache Wicket, however, we actually need to two checks to determine either. If they inherited a common parent class, it needed one check. I do not want to say that Apache Wicket should have done this. I first want to understand why this design decision has been made. because we could not come up with a good usecase for having a common parent. in any case there would have to be two parents - one for checked and one for unchecked exceptins. which means that both would have to implement some kind of a tagging interface to allow a single instanceof check. but without a valid usecase why do this? if you really want to know you can see if the exception class lives in the org.apache.wicket.* package, and if it does its a wicket exception. -igor On Wed, May 1, 2013 at 10:04 AM, Igor Vaynberg igor.vaynb...@gmail.com wrote: what is the purpose of knowing whether an exception is a wicket exception or something from further down the stack? eg how would you handle a runtime exception that came from within java.lang.String differently then the one that came from Wicket or the one that came from the servlet api? -igor On Wed, May 1, 2013 at 12:23 AM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I've been working on an error page in Apache Wicket and came across a general pattern in Apache Wicket and I'd like to understand the reason for it. Exceptions in Apache Wicket do not have a single class hierarchy; i.e. there are exceptions that eventually extend WicketRuntimeException but they are also many others that start either from RuntimeException or Exception. I could guess for the reasons for checked exceptions but why did *not* Apache Wicket introduce exception classes that all inherit from a single exception class? A direct side effect of this design decision is that the check (e instanceof WicketRuntimeException) cannot give an indication if the exception is actually an exception raised by Wicket and need separate checks for different concerns. Thanks in advance for your explanations. Regards, Behrooz - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- -- Behrooz Nobakht - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- -- Behrooz Nobakht
Re: Wicket form with AJAX drop down choice and AJAX button not process POST data
Hi, I've also tested without the prefix input name and it's still the same. Thanks, Behrooz On Thu, Jan 3, 2013 at 9:08 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, If you are able to reproduce the problem in a quickstart application then please attach it to a ticket in Jira. But I guess the problem is related to the custom prefix you use (# getInputNamePrefix()). In FormComponent#getInputAsArray() check what is the inputName and compare it against the ones shown by Firebug. On Thu, Jan 3, 2013 at 1:56 AM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I'm trying to have a simple widget in Apache Wicket 6.4.0 using Form http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/Form.html , DropDownChoice http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/DropDownChoice.html ,AjaxButton http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/markup/html/form/AjaxButton.html along with AjaxFormComponentUpdatingBehavior http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.html . The model (an inner class) that is used is as follows: private class SampleModel implements IClusterable { private static final long serialVersionUID = 1L; private String value; public void setValue(String value) { this.value = value; } public String getValue() { return value; } @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof SampleModel == false) { return false; } return hashCode() == obj.hashCode(); } } The form is another class as: private class TheForm extends FormSampleModel { private static final long serialVersionUID = 1L; // This form is to be used several times in a single large page private final String prefix = form_ + (counter++) + _; public TheForm(String id, SampleModel model) { super(id, new CompoundPropertyModel(model)); ListString choices = getChoices(); final DropDownChoiceString select = new DropDownChoiceString(value, choices); select.setOutputMarkupId(true); select.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }); AjaxButton action1 = new AjaxButton(action, Model.of(Ajax Action)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }; action1.setOutputMarkupId(true); add(select); add(action1); } @Override protected String getInputNamePrefix() { return prefix; } } And putting it all together in a simple widget class: public class SampleFormDropDownWidget extends Panel { private static final long serialVersionUID = 1L; private static int counter = 1; private SampleModel model = new SampleModel(); public SampleFormDropDownWidget(String id) { super(id); model.setValue(C); TheForm form = new TheForm(form, model); add(form); } private ListString getChoices() { return Lists.newArrayList(A, B, C, D, E, F, G); }} And the markup HTML is: wicket:panel form class=form-horizontal wicket:id=form div class=control-group label class=control-labelChoices/label div class=controls select class=input-xlarge wicket:id=value/select /div /div div class=form-actions input class=btn wicket:id=action / /div /form/wicket:panel Using a client debugging tool such as FireBug, I can trace that the AJAX request actually carries POST data, e.g.: form_1_formb1_hf_0=form_1_value=5form_1_action=Ajax+Actionform_1_action=1 However, in both cases of onUpdate for the select component and onSubmit for the button, I getnull values
Re: Wicket form with AJAX drop down choice and AJAX button not process POST data
Hi again, I tried the quick start application and tracked down the issue to this. When a selection is changed (using FireBug/Chrome), * in the quick start application, I see that of the request is Content-Type: application/x-www-form-urlencoded; charset=UTF-8 * in my application, I see that the content-type of the request is text/plain This is why in my application, the request POST data is actually ignored. I verified that all my HTML files start with !DOCTYPE html html xmlns:wicket=http://wicket.apache.org; So, can you please let me know how to fix this? Thanks, Behrooz On Thu, Jan 3, 2013 at 5:42 PM, Behrooz Nobakht nob...@gmail.com wrote: Hi, I've also tested without the prefix input name and it's still the same. Thanks, Behrooz On Thu, Jan 3, 2013 at 9:08 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, If you are able to reproduce the problem in a quickstart application then please attach it to a ticket in Jira. But I guess the problem is related to the custom prefix you use (# getInputNamePrefix()). In FormComponent#getInputAsArray() check what is the inputName and compare it against the ones shown by Firebug. On Thu, Jan 3, 2013 at 1:56 AM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I'm trying to have a simple widget in Apache Wicket 6.4.0 using Form http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/Form.html , DropDownChoice http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/DropDownChoice.html ,AjaxButton http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/markup/html/form/AjaxButton.html along with AjaxFormComponentUpdatingBehavior http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.html . The model (an inner class) that is used is as follows: private class SampleModel implements IClusterable { private static final long serialVersionUID = 1L; private String value; public void setValue(String value) { this.value = value; } public String getValue() { return value; } @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof SampleModel == false) { return false; } return hashCode() == obj.hashCode(); } } The form is another class as: private class TheForm extends FormSampleModel { private static final long serialVersionUID = 1L; // This form is to be used several times in a single large page private final String prefix = form_ + (counter++) + _; public TheForm(String id, SampleModel model) { super(id, new CompoundPropertyModel(model)); ListString choices = getChoices(); final DropDownChoiceString select = new DropDownChoiceString(value, choices); select.setOutputMarkupId(true); select.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }); AjaxButton action1 = new AjaxButton(action, Model.of(Ajax Action)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }; action1.setOutputMarkupId(true); add(select); add(action1); } @Override protected String getInputNamePrefix() { return prefix; } } And putting it all together in a simple widget class: public class SampleFormDropDownWidget extends Panel { private static final long serialVersionUID = 1L; private static int counter = 1; private SampleModel model = new SampleModel(); public SampleFormDropDownWidget(String id) { super(id); model.setValue(C); TheForm form = new TheForm(form, model); add(form); } private ListString getChoices() { return Lists.newArrayList(A, B, C, D, E, F, G); }} And the markup HTML is: wicket:panel form class=form-horizontal wicket:id=form
Re: Wicket form with AJAX drop down choice and AJAX button not process POST data
Hi again, Just wanted to update that the issue is resolved. There was a custom script that sets the content type of AJAX on jQuery.$ to be text/plain and it had a side effect. Sorry for the inconvenience. Regards, Behrooz On Thu, Jan 3, 2013 at 9:01 PM, Behrooz Nobakht nob...@gmail.com wrote: Hi again, I tried the quick start application and tracked down the issue to this. When a selection is changed (using FireBug/Chrome), * in the quick start application, I see that of the request is Content-Type: application/x-www-form-urlencoded; charset=UTF-8 * in my application, I see that the content-type of the request is text/plain This is why in my application, the request POST data is actually ignored. I verified that all my HTML files start with !DOCTYPE html html xmlns:wicket=http://wicket.apache.org; So, can you please let me know how to fix this? Thanks, Behrooz On Thu, Jan 3, 2013 at 5:42 PM, Behrooz Nobakht nob...@gmail.com wrote: Hi, I've also tested without the prefix input name and it's still the same. Thanks, Behrooz On Thu, Jan 3, 2013 at 9:08 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, If you are able to reproduce the problem in a quickstart application then please attach it to a ticket in Jira. But I guess the problem is related to the custom prefix you use (# getInputNamePrefix()). In FormComponent#getInputAsArray() check what is the inputName and compare it against the ones shown by Firebug. On Thu, Jan 3, 2013 at 1:56 AM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I'm trying to have a simple widget in Apache Wicket 6.4.0 using Form http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/Form.html , DropDownChoice http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/markup/html/form/DropDownChoice.html ,AjaxButton http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/markup/html/form/AjaxButton.html along with AjaxFormComponentUpdatingBehavior http://ci.apache.org/projects/wicket/apidocs/6.0.x/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.html . The model (an inner class) that is used is as follows: private class SampleModel implements IClusterable { private static final long serialVersionUID = 1L; private String value; public void setValue(String value) { this.value = value; } public String getValue() { return value; } @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof SampleModel == false) { return false; } return hashCode() == obj.hashCode(); } } The form is another class as: private class TheForm extends FormSampleModel { private static final long serialVersionUID = 1L; // This form is to be used several times in a single large page private final String prefix = form_ + (counter++) + _; public TheForm(String id, SampleModel model) { super(id, new CompoundPropertyModel(model)); ListString choices = getChoices(); final DropDownChoiceString select = new DropDownChoiceString(value, choices); select.setOutputMarkupId(true); select.add(new AjaxFormComponentUpdatingBehavior(onchange) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }); AjaxButton action1 = new AjaxButton(action, Model.of(Ajax Action)) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form? form) { String m1 = select.getModelObject(); String m2 = TheForm.this.getModelObject().getValue(); System.out.println(m1 + = + m2); } }; action1.setOutputMarkupId(true); add(select); add(action1); } @Override protected String getInputNamePrefix() { return prefix; } } And putting it all together in a simple widget class: public class SampleFormDropDownWidget extends Panel { private static final long serialVersionUID = 1L; private static int counter = 1; private SampleModel model = new SampleModel(); public SampleFormDropDownWidget(String id) { super(id
Re: How to suppress WicketSerializationException using ListView
Thanks, solved the problem. On Mon, Mar 5, 2012 at 11:14 AM, vineet semwal vineetsemwal1...@gmail.comwrote: use loadabledetachablemodel and it should load a list of your unserialiable entities that will poupulate your listview On Mon, Mar 5, 2012 at 3:39 PM, Behrooz Nobakht nob...@gmail.com wrote: Hello, I'm using a ListView*S* in which S is not serializable but it is not either kept in the page data structure. So, every time the page is rendered, I fetch a list of *S* and then construct the ListView. Even in this point, I am not really sure if this assumption is correct but I am assuming that since no data is kept at the page component level, so there is not need for *S* to be serializable. However, I get the following exception in which *T extends S*: 2012-03-05 10:48:55,002 ERROR [http-8080-6] Error serializing object class com.my.MyPage [object=[Page class = com.my.MyPage, id = 7, render count = 1]] (JavaSerializer.java:94) org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: com.my.T Field hierarchy is: 7 [class=com.my.MyPage, path=7] private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;] java.lang.Object org.apache.wicket.Component.data[9] [class=com.my.MyPage$MyListView, path=7:serviceInstances] java.lang.Object org.apache.wicket.Component.data [class=org.apache.wicket.model.util.WildcardListModel] private java.lang.Object org.apache.wicket.model.util.GenericBaseModel.object [class=java.util.ArrayList] private java.lang.Object org.apache.wicket.model.util.GenericBaseModel.object[write:1] [class=* com.my.T*] *- field that is not serializable* at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:386) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.access$500(SerializableChecker.java:65) at org.apache.wicket.util.io.SerializableChecker$1InterceptingObjectOutputStream.replaceObject(SerializableChecker.java:525) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1140) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) at java.util.ArrayList.writeObject(ArrayList.java:710) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:532) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:646) at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:569) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:646) at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:569) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:431) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:646) at org.apache.wicket.util.io.SerializableChecker.internalCheck(SerializableChecker.java:569) at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:365) at org.apache.wicket.util.io.SerializableChecker.writeObjectOverride(SerializableChecker.java:715) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342) at org.apache.wicket.serialize.java.JavaSerializer$CheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:258) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342) at org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:77) at org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:368) at org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:146