Re: Relative Path and Resource loading in wicket
On Fri, Nov 16, 2012 at 7:55 AM, delta458 delta...@hotmail.com wrote: Hello, Im sitting now 6 hours non-stop on this problem and cant get it work. I want a simple thing. I have a Invoice.js file in my resource folder. I want to get this file and write something to it: so I did: /URL url = getClass().getResource(Invoice.js); Your problems is here ^^. getClass().getResource() looks in the classpath. File file = new File(url.getPath()); System.out.println(url.getPath()); BufferedWriter out = new BufferedWriter(new FileWriter(file), 32768); out.write(TEST); out.close();/ But thats not working. He writes into the file successfully, but saves the file into the maven target folder :( I need to read from that file later, so I need to use it again. How can I make wicket to write to the relative path and not save it in the target folder... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930.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 P.S. There is nothing Wicket related in this question. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: CouldNotLockPageException in production
Hi, Look again in the logs. Next to this exception there is another one explaining which thread keeps a reference to the page for more than one minute. References: org.apache.wicket.settings.IExceptionSettings#setThreadDumpStrategy org.apache.wicket.settings.IRequestCycleSettings#getTimeout On Thu, Nov 15, 2012 at 8:30 PM, Alfonso Quiroga alfonsose...@gmail.comwrote: Hi! We have a simple wicket application, which does NOT save page versions, because we do this: Application#getPageSettings().setVersionPagesByDefault(false); The application is in production running in a Jboss, and sometimes we have this exception: org.apache.wicket.page.CouldNotLockPageException: Could not lock page 0. Attempt lasted 1 minute at org.apache.wicket.page.PageAccessSynchronizer.lockPage(PageAccessSynchronizer.java:146) at org.apache.wicket.page.PageAccessSynchronizer$2.getPage(PageAccessSynchronizer.java:197) at org.apache.wicket.DefaultMapperContext.getPageInstance(DefaultMapperContext.java:117) Any ideas? We are using Wicket 1.5.8 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Asking for user confirmation - Wicket 6
Am 15.11.2012 18:47, schrieb Sven Meier: ajaxCallListener.onPrecondition(return confirm('are you sure'?);); I made a test and found the small Typo, should be: ajaxCallListener.onPrecondition(return confirm('are you sure?');); Dieter - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Add filter serch in datatable sortable
someone can lend a hand. I found this example but is for a single datatable. http://www.javabeat.net/2011/04/displaying-data-using-datatable-in-apache-wicket/ paragraph filtering. ??? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Add-filter-serch-in-datatable-sortable-tp4653936.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: CouldNotLockPageException in production
Martin, thank you, I could resolve this problem yesterday, I share the solution because it helps somebody We have a backend, and in some custom searches it can take 50 or 60 seconds (or more) to get the results. When the backend is searching, and the user press BACK BUTTON, we've a strategy that tries to get the SAME page (same instance) and in this point is where the exception raises. This is is because we don't use page versioning, so the home page has always the page-id 1. So: * when the page is blocked searching, and more than 1 minute has happened (default time), if the user press BACK BUTTON and wicket tries to recover the same page-instance, the exception CouldNotLockPageException is rised * if we have the same scenario but the user press BACK BUTTON before 1 minute, nothing happens (works fine) So we've done 2 solutions First, change the default request timeout to 5 minutes, doing this: Application#getRequestCycleSettings().setTimeout( Duration.minutes(5) ); (because we know that our backend can take all that time) Then, in my exception-handler, if CouldNotLockPageException is rised, I capture it, and then I invalidate the session and I force redirection to login page. If someone needs the code of the exception handler (method onExcetion() ) (..) boolean couldNotLock = anException.getCause() != null anException.getCause().getClass().equals(InvocationTargetException.class) anException.getCause().getCause() != null anException.getCause().getCause().getClass().equals(CouldNotLockPageException.class); if (couldNotLock) { - invalidate session - redirect to login page } (...) thanks On Fri, Nov 16, 2012 at 5:30 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Look again in the logs. Next to this exception there is another one explaining which thread keeps a reference to the page for more than one minute. References: org.apache.wicket.settings.IExceptionSettings#setThreadDumpStrategy org.apache.wicket.settings.IRequestCycleSettings#getTimeout On Thu, Nov 15, 2012 at 8:30 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Hi! We have a simple wicket application, which does NOT save page versions, because we do this: Application#getPageSettings().setVersionPagesByDefault(false); The application is in production running in a Jboss, and sometimes we have this exception: org.apache.wicket.page.CouldNotLockPageException: Could not lock page 0. Attempt lasted 1 minute at org.apache.wicket.page.PageAccessSynchronizer.lockPage(PageAccessSynchronizer.java:146) at org.apache.wicket.page.PageAccessSynchronizer$2.getPage(PageAccessSynchronizer.java:197) at org.apache.wicket.DefaultMapperContext.getPageInstance(DefaultMapperContext.java:117) Any ideas? We are using Wicket 1.5.8 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Wicket and file upload with blueimp jquery file upload
I solved the problems I had, modifying the main.js file of the demo, as follows. $(function () { 'use strict'; $('#${componentMarkupId}').fileupload({ url: '${url}', paramName: '${paramName}', singleFileUploads: true, maxFileSize: 500, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, process: [ { action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: 2000 // 20MB }, { action: 'resize', maxWidth: 1440, maxHeight: 900 }, { action: 'save' } ] }); }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-file-upload-with-blueimp-jquery-file-upload-tp4653007p4653938.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: Asking for user confirmation - Wicket 6
Thanks - I noticed that also - the wiki entry has the correct code. Nick On Fri, Nov 16, 2012 at 4:26 AM, Dieter Tremel tre...@tremel-computer.dewrote: Am 15.11.2012 18:47, schrieb Sven Meier: ajaxCallListener.onPrecondition(return confirm('are you sure'?);); I made a test and found the small Typo, should be: ajaxCallListener.onPrecondition(return confirm('are you sure?');); Dieter - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: retriving the actual page instance
Hi, The official way is: session.getPageManager().getPage(pageId) This will look in the httpsession and fallback to disk. On Fri, Nov 16, 2012 at 4:33 PM, Alfonso Quiroga alfonsose...@gmail.comwrote: Hi, is there a way to get the actual IRequestablePage? I have only one, and if I debug the HttpSession, I have this key: wicket:wicket.wicketGuide:wicket:persistentPageManagerData which holds the PageStoreManager$SessionEntry, where is the actual page I'm looking for. I don't want to access in that way (navigating throw the raw httpSession). I think there should be a better way using Wicket classes. Does anybody know? thanks! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: Relative Path and Resource loading in wicket
@Ernest I just need to write some variables to the .js file like var price; var user; @MartinGrigorov so what should I do to make this work? How can I set my resource to the classpath? and what should I call to make it work? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930p4653945.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: retriving the actual page instance
Martin, thank you again! This helps me a lot! what I dislike is that I need to know the page id, is there a way to know the last page id? by now.. I'll put this id in the session On Fri, Nov 16, 2012 at 11:47 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, The official way is: session.getPageManager().getPage(pageId) This will look in the httpsession and fallback to disk. On Fri, Nov 16, 2012 at 4:33 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Hi, is there a way to get the actual IRequestablePage? I have only one, and if I debug the HttpSession, I have this key: wicket:wicket.wicketGuide:wicket:persistentPageManagerData which holds the PageStoreManager$SessionEntry, where is the actual page I'm looking for. I don't want to access in that way (navigating throw the raw httpSession). I think there should be a better way using Wicket classes. Does anybody know? thanks! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: retriving the actual page instance
Why do you need this functionality ? On Fri, Nov 16, 2012 at 5:54 PM, Alfonso Quiroga alfonsose...@gmail.comwrote: Martin, thank you again! This helps me a lot! what I dislike is that I need to know the page id, is there a way to know the last page id? by now.. I'll put this id in the session On Fri, Nov 16, 2012 at 11:47 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, The official way is: session.getPageManager().getPage(pageId) This will look in the httpsession and fallback to disk. On Fri, Nov 16, 2012 at 4:33 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Hi, is there a way to get the actual IRequestablePage? I have only one, and if I debug the HttpSession, I have this key: wicket:wicket.wicketGuide:wicket:persistentPageManagerData which holds the PageStoreManager$SessionEntry, where is the actual page I'm looking for. I don't want to access in that way (navigating throw the raw httpSession). I think there should be a better way using Wicket classes. Does anybody know? thanks! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/
Re: retriving the actual page instance
I used this approach https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html to retrieve the last page instance from request cycle. 1. Register handler in your Application: getRequestCycleListeners().add(new PageRequestHandlerTracker()); 2. Retrieve page as follows: IPageRequestHandler lastHandler = PageRequestHandlerTracker.getLastHandler(RequestCycle.get()); IRequestablePage page = lastHandler == null ? null : lastHandler.getPage(); Hope this helps, Alec On Fri, Nov 16, 2012 at 8:55 AM, Martin Grigorov mgrigo...@apache.org wrote: Why do you need this functionality ? On Fri, Nov 16, 2012 at 5:54 PM, Alfonso Quiroga alfonsose...@gmail.comwrote: Martin, thank you again! This helps me a lot! what I dislike is that I need to know the page id, is there a way to know the last page id? by now.. I'll put this id in the session On Fri, Nov 16, 2012 at 11:47 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, The official way is: session.getPageManager().getPage(pageId) This will look in the httpsession and fallback to disk. On Fri, Nov 16, 2012 at 4:33 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Hi, is there a way to get the actual IRequestablePage? I have only one, and if I debug the HttpSession, I have this key: wicket:wicket.wicketGuide:wicket:persistentPageManagerData which holds the PageStoreManager$SessionEntry, where is the actual page I'm looking for. I don't want to access in that way (navigating throw the raw httpSession). I think there should be a better way using Wicket classes. Does anybody know? thanks! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Relative Path and Resource loading in wicket
I had a similar problem and considered Martin's approach, but ended up creating a div wicket:id=myVar class=myVarvar value/div on my page and accessed it from JS file using $(div.myVar).text() or something like that. The advantage of div approach is that you can test it statically without deploying the webapp and your JS file can be safely cached by the browser improving load time. Alec On Fri, Nov 16, 2012 at 7:58 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: You can do something like On your panel public void renderHead(final IHeaderResponse response) { PackagedTextTemplate template = new PackagedTextTemplate(MyPanel.class, test.js); MapString, Object vars = new MiniMapString, Object(1); vars.put(val1, MyValue); response.renderOnDomReadyJavascript(template.asString(vars)); } test.js= var bla = '${val1}'; On Fri, Nov 16, 2012 at 3:51 PM, delta458 delta...@hotmail.com wrote: @Ernest I just need to write some variables to the .js file like var price; var user; @MartinGrigorov so what should I do to make this work? How can I set my resource to the classpath? and what should I call to make it work? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930p4653945.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 -- Regards - Ernesto Reinaldo Barreiro Antilia Soft http://antiliasoft.com/ http://antiliasoft.com/antilia - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: retriving the actual page instance
Thanks to both. Alec approach worked for me in other case, not in this one. In this case, we had the problem that StaleException was rising, when user open multiple tabs with the same session (like Firefox) In that case, I was invalidating the whole session and redirecting to login. But now, the user stays in the same page (with the last state) using Session.get().getPageManager().getPage( id ) So now, the user can have multiple tabs and works fine. Thanks to both Martin and Alec! On Fri, Nov 16, 2012 at 1:30 PM, Alec Swan alecs...@gmail.com wrote: I used this approach https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html to retrieve the last page instance from request cycle. 1. Register handler in your Application: getRequestCycleListeners().add(new PageRequestHandlerTracker()); 2. Retrieve page as follows: IPageRequestHandler lastHandler = PageRequestHandlerTracker.getLastHandler(RequestCycle.get()); IRequestablePage page = lastHandler == null ? null : lastHandler.getPage(); Hope this helps, Alec On Fri, Nov 16, 2012 at 8:55 AM, Martin Grigorov mgrigo...@apache.org wrote: Why do you need this functionality ? On Fri, Nov 16, 2012 at 5:54 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Martin, thank you again! This helps me a lot! what I dislike is that I need to know the page id, is there a way to know the last page id? by now.. I'll put this id in the session On Fri, Nov 16, 2012 at 11:47 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, The official way is: session.getPageManager().getPage(pageId) This will look in the httpsession and fallback to disk. On Fri, Nov 16, 2012 at 4:33 PM, Alfonso Quiroga alfonsose...@gmail.com wrote: Hi, is there a way to get the actual IRequestablePage? I have only one, and if I debug the HttpSession, I have this key: wicket:wicket.wicketGuide:wicket:persistentPageManagerData which holds the PageStoreManager$SessionEntry, where is the actual page I'm looking for. I don't want to access in that way (navigating throw the raw httpSession). I think there should be a better way using Wicket classes. Does anybody know? thanks! -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
how to fix this error in wicket app
[12:52:52.119] Wicket.Ajax: FunctionsExecuter.processNext: [Exception... Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIObserverService.addObserver] nsresult: 0x80004002 (NS_NOINTERFACE) location: JS frame :: resource:///components/ConsoleAPI.js :: CA_init :: line 57 data: no] @ http://localhost:9080/wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-ajax-jquery-debug-ver-1352317451197.js:125 Subsequently this error means no Ajax events are processed unless page is refreshed. Channel '0' is busy - scheduling the callback to be executed when the previous requ Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-fix-this-error-in-wicket-app-tp4653954.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 fix this error in wicket app
On Fri 16.11.2012 10:51, saty wrote: I have this additional info on wicket debug panel. [ ... ] ERROR: FunctionsExecuter.processNext: InternalError: too much recursion ERROR: FunctionsExecuter.processNext: [Exception... Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIObserverService.addObserver] nsresult: 0x80004002 (NS_NOINTERFACE) location: JS frame :: resource:///components/ConsoleAPI.js :: CA_init :: line 57 data: no] Seeing the last three lines, I would guess that this not a Wicket bug. It rather seems to be a Firefox Developer extension bug. -Timo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: any book about wicket 6?
I didn't write an article on tree components yet :) , but I've built a very basic example for NestedTree. The code is quite simple and it uses both nodes and model from Swing package (like the old Tree component). You can find it here: https://github.com/bitstorm/Wicket-tutorial-examples/tree/master/CheckBoxAjaxTree On 11/15/2012 03:27 PM, Martin Grigorov wrote: I'd like an article about the new Tree/TreeTable components in Wicket 6. I find it hard to grasp. Maybe because most of its code is in wicket-examples and the example there is too big and abstract. I tried twice to migrate from the old/deprecated TableTree and both times I gave up. On Wed, Nov 14, - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
update webmarkupcontainer from fragment , container onBeforeRender() method is not being called
I have a fragment with a link inside, onclick of this link I want to update a webmarkupcontainer in my page for which I add this container to the target. surprisingly its not calling onBeforeRender() method of this container, in ajaxdebug window I see the container mark in the response ? I am still using wicket 1.4.12, Please advice. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/update-webmarkupcontainer-from-fragment-container-onBeforeRender-method-is-not-being-called-tp4653960.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: Access to markup
Take a look at Component's method onComponentTagBody. One of its parameters is MarkupStream which provides access to previous tags (it has method getPreviousTag()). Is it possible to get access to the markup of preceding elements in a Component's rendering? Im wondering if I can detect the presence of a label element preceding an input field (Textfield) N - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org