(Un-)deployment woes on Tomcat (and JBoss)
Hi, I'm having problems with deployment/undeployment of Wicket apps on Tomcat (and also JBoss, though I think it's related to the fact that it embeds Tomcat). Basically, in both cases undeployment comes back with an Exception, leaving the server in a dirty state and I have to restart the server every time. This has been mentioned in both the user and developer lists, but with no reply: http://old.nabble.com/java.lang.NoClassDefFoundError:-org-apache-wicket-util-lang-PropertyResolver-tc26191924.html http://old.nabble.com/Weird-error-on-shutdown...-td18907685.html The problem manifests only when deploying EXPLODED wars (with a single packaged WAR file, the problem goes away). It can be easily reproduced as follows: 1) Create an instance of the quickstart archetype (http://wicket.apache.org/quickstart.html). Let's say you used the default values so the artifact id is myproject from here on. Use the latest 1.4.7 version of Wicket (though I've tried with all previous versions up to 1.4.4 and the result is the same; the reference above uses version 1.4-m2, so it must be surprisingly old). 2) Create an EXPLODED web archive (war) with mvn war:exploded 3) Move the exploded war folder (myproject-1.0-SNAPSHOT) to the deployment folder (server/xxx/deploy for JBoss or webapps) 4) Undeploy by moving the exploded war folder (myproject-1.0-SNAPSHOT), OUT of the deployment folder You will get a stack trace that basically ends up in a ClassNotFound exception when the Wicket filter is cleaning up: java.lang.NoClassDefFoundError: org/apache/wicket/util/lang/PropertyResolver at org.apache.wicket.Application.internalDestroy(Application.java:952) at org.apache.wicket.protocol.http.WebApplication.internalDestroy(WebApplication.java:527) at org.apache.wicket.protocol.http.WicketFilter.destroy(WicketFilter.java:179) at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:267) This is a huge annoyance, because re-deployment of the application does not work; if you try to deploy it again, JBoss fails with: org.jboss.deployers.spi.DeploymentException: Web mapping already exists for deployment URL file:/F:/ade_ws/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_(default)/deploy/myproject-1.0-SNAPSHOT/ at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:187) Basically, you must restart the entire JBoss server. In a production environment it means you can't upgrade your wicket applications without affecting other applications (though you can get away if you don't use an exploded WAR folder). In a developer environment it's totally counter-productive: you need the exploded format and restaring JBoss every time is quite irritating. The Eclipse WTP adapter runs in exploded mode which basically makes working with Eclipse a nightmare. I am using JDK1.6 (I use 1.6.0_18) and either JBoss5.1 or Tomcat 6.0.26 (or 6.0.18 or 5.5.28 which I also tried). My system is running Windows 7 and NTFS (it may be relevant to the way the file-system handles moving folders). Last notes: 1) I had a look at the code. It seems that Wicket tries to use weak references to facilitate a thorough clean-up of the JVM by garbage collection after the application is undeployed. This may be related, as it appears to me as if the class loader used by the application is no longer available during clean-up. I think there's some class-loading magic going on, probably the thread's context class loader is being switched, which ends up in the destroy() method not having access to wicket. 2) Jetty does not seem to have any problems, so it must be something in the way Tomcat works. 3) The complete stack trace in my case (Win7, JDK1.6.0_18-win32, JBoss5.1, Wicket1.4.7) is: java.lang.NoClassDefFoundError: org/apache/wicket/util/lang/PropertyResolver at org.apache.wicket.Application.internalDestroy(Application.java:952) at org.apache.wicket.protocol.http.WebApplication.internalDestroy(WebApplication.java:527) at org.apache.wicket.protocol.http.WicketFilter.destroy(WicketFilter.java:179) at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:267) at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3818) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4605) at org.apache.catalina.core.ContainerBase.destroy(ContainerBase.java:1175) at org.apache.catalina.core.StandardContext.destroy(StandardContext.java:4705) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at
Re: (Un-)deployment woes on Tomcat (and JBoss)
Ok, I've pinpointed the underlying cause. Indeed, the file is simply removed before the destroy() method has a chance to clean up. I verified this by using this ugly hack: 1. Adding a field: private InputStream wicketJarProtector; 2. In WicketFilter.init() I open the wicket jar to protect it from deletion: wicketJarProtector = filterConfig.getServletContext().getResourceAsStream(/WEB-INF/lib/wicket.jar); 3. In WicketFilter.destroy() I close the file handle: wicketJarProtector.close(); This prevents the file from being deleted, undeployment completes successfully. I'm not sure how to properly fix this... Any ideas? On 21/3/2010 11:38 πμ, Alexandros Karypidis wrote: Well, if I force the class to be loaded early this way, destroy() simply fails a little bit further down, when trying to load a nested class. java.lang.NoClassDefFoundError: org/apache/wicket/util/lang/PropertyResolver$IClassCache at org.apache.wicket.Application.internalDestroy(Application.java:952) at org.apache.wicket.protocol.http.WebApplication.internalDestroy(WebApplication.java:527) at org.apache.wicket.protocol.http.WicketFilter.destroy(WicketFilter.java:180) ... I could keep going by adding references to such classes until every class needed to complete destroy() is pre-loaded, but the fact is that for some reason, there is no more access to wicket.jar in WEB-INF/lib. I added debugged through the code and the weird thing is that it's the same class-loader AND the same thread (JBoss' [HDScanner] thread). So it should be able to load these classes. A look at the bottom of the stack trace reveals this (notice that there is a DelegatingHandler to wicket.jar and all packages for wicket are listed; so it's as if wicket.jar is simply no longer in its place (i.e. the OS removes it before the class loader has a chance to load the classes needed for destroy): Caused by: java.lang.ClassNotFoundException: org.apache.wicket.util.lang.PropertyResolver$IClassCache from baseclassloa...@10496f0{vfsclassloaderpolicy@517ead{name=vfsfile:/F:/ade_ws/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_(default)/deploy/wicket-cl-test.war/ domain=classloaderdom...@1e351a2{name=vfsfile:/F:/ade_ws/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_(default)/deploy/wicket-cl-test.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=classloaderdom...@4d41e2{defaultdomain}} roots=[.., delegatinghand...@8305721[path=wicket-cl-test.war/WEB-INF/lib/wicket.jar context=file:/F:/ade_ws/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_(default)/deploy/ real=file:/F:/ade_ws/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_(default)/deploy/wicket-cl-test.war/WEB-INF/lib/wicket.jar]] delegates=null exported=[, org.apache.wicket.util.diff.myers, org.apache.wicket.markup.transformer, org.apache.wicket.authorization.strategies.page, org.apache.wicket.ajax.form, org.apache.log4j, org.apache.wicket.util.convert, org.apache.wicket.util.resource, org.apache.wicket.authorization.strategies, org.apache.log4j.lf5.config, org.apache.log4j.spi, org.apache.wicket.protocol.http.servlet, org.apache.wicket.markup.resolver, org.apache.wicket.request.target.resource, org.apache.wicket.util.parse.metapattern, ] IMPORT-ALLNON_EMPTY}} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 72 more On 20/3/2010 10:25 μμ, Igor Vaynberg wrote: interesting, wonder why the class would be unloaded *before* the application classloader. try this, add a field private PropertyClassResolver resolver=null; to your application subclass, see if the field is enough to stop the class from unloading. -igor On Sat, Mar 20, 2010 at 9:06 AM, Alexandros Karypidisakary...@yahoo.gr wrote: Hi, I'm having problems with deployment/undeployment of Wicket apps on Tomcat (and also JBoss, though I think it's related to the fact that it embeds Tomcat). Basically, in both cases undeployment comes back with an Exception, leaving the server in a dirty state and I have to restart the server every time. This has been mentioned in both the user and developer lists, but with no reply: http://old.nabble.com/java.lang.NoClassDefFoundError:-org-apache-wicket-util-lang-PropertyResolver-tc26191924.html http://old.nabble.com/Weird-error-on-shutdown...-td18907685.html The problem manifests only when deploying EXPLODED wars (with a single packaged WAR file, the problem goes away). It can be easily reproduced as follows: 1) Create an instance of the quickstart archetype (http://wicket.apache.org/quickstart.html). Let's say you used the default values so the artifact id is myproject from here on. Use the latest 1.4.7 version of Wicket (though I've tried with all previous versions up to 1.4.4 and the result is the same; the reference above uses version 1.4-m2, so it must
How do I provide digit-only IDs to make childs safe?
Hi, I'm a new Wicket user who is also getting familiar with the GMap2 module from wicket-stuff. I'm using the geocode example as a basis for creating a form which allows you to search for a location and set the map viewport to display it: https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/gmap2-parent/gmap2-examples/src/main/java/wicket/contrib/examples/gmap/geocode/ The code works, but every time I search for a place I get a warning: WARN - AbstractRepeater - Child component of repeater org.apache.wicket.markup.repeater.RepeatingView:content has a non-safe child id of [STRING_SEARCHED]. Safe child ids must be composed of digits only. The [STRING_SEARCHED] is whatever I typed in the text field (e.g. Barcelona, Spain or Athens, Greece). So apparently, GMap2 sets an ID somewhere using the text field's value, violating some Wicket expectation that such IDs should be composed using digits only. How can I fix this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Beginner localization question
Hi, How can I have Wicket resolve a key to some localized messages with my own code at runtime? The reason I ask is because I have this use case: 1) I use Java enumerations to strongly-type a RadioChoice control: public enum RadioOptions { ONE, TWO, THREE } 2) I strongly-type a RadioChoice control: public SomePage() { ... RadioOptions radio = RadioOptions.ONE; RadioChoiceRadioOptions r = new RadioChoiceRadioOptions(..., Arrays.asList(RadioOptions.values())); ... 3) Define localized messages in the MyWicketApplication_xx.xml file: entry key=ONEFirst option text/entry 4) Overload toString() as follows: public enum RadioOptions { ONE, TWO, THREE; public String toString() { String key = this.name(); // ONE, TWO or THREE return .; // how do I ask Wicket to search for the localized message? } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Another beginner localization question
Hi, I'm using a wicket:message tags, property files and a ChoiceRenderer to allow users to switch the Locale. My ChoiceRenderer overrides wantOnSelectionChangedNotifications() to have the browser send a Locale change event to the server and when this call returns, all wicket:message content is updated to match the new locale's messages. This all works fine. However, I also have a DatePicker JQueryUI component component on my page which needs to be adjusted. This is done by having the browser execute the JavaScript: script type='text/javascript' $(function() { $.datepicker.setDefaults($.datepicker.regional['_[LOCALE]_']); }); /script Is it possible to have the browser to execute some dynamically-generated JavaScript using the ChoiceRenderer's onSelectionChanged() event? Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Another beginner localization question
Aha! ...the joys of learning Wicket! :-) On 19/4/2010 10:58 μμ, Pedro Santos wrote: Your ChoiceRenderer can implement IHeaderContributor and add your javascript to IHeaderResponse object, since when the user change the value on the selection component, the page will to be re-rendered On Mon, Apr 19, 2010 at 4:54 PM, Alexandros Karypidisakary...@yahoo.grwrote: Hi, I'm using awicket:message tags, property files and a ChoiceRenderer to allow users to switch the Locale. My ChoiceRenderer overrides wantOnSelectionChangedNotifications() to have the browser send a Locale change event to the server and when this call returns, allwicket:message content is updated to match the new locale's messages. This all works fine. However, I also have a DatePicker JQueryUI component component on my page which needs to be adjusted. This is done by having the browser execute the JavaScript: script type='text/javascript' $(function() { $.datepicker.setDefaults($.datepicker.regional['_[LOCALE]_']); }); /script Is it possible to have the browser to execute some dynamically-generated JavaScript using the ChoiceRenderer's onSelectionChanged() event? Thanks in advance. - 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
AjaxFormComponentUpdatingBehavior and id attribute
Hi, When I add an AjaxFormComponentUpdatingBehavior to a component (a TextFieldString in particular though I don't think that matters), Wicket assigns an HTML id attribute to the component by taking the wicket:id value I specified and appending a character. So, if my original HTML had: input wicket:id=birthday id=x type=text / At runtime I get: input wicket:id=birthday id=birthdayX type=text / This messes up some static CSS/Javascript I have in the page, which relies on locating hte component using its original id. Is there a way to prevent this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: AjaxFormComponentUpdatingBehavior and id attribute
Ok, I get it, thank you. On 22/4/2010 21:55, Martin Makundi wrote: Hi! You can call component.setMarkupId(component.getId()); ** Martin 2010/4/22 Alexandros Karypidisakary...@yahoo.gr: Hi, When I add an AjaxFormComponentUpdatingBehavior to a component (a TextFieldString in particular though I don't think that matters), Wicket assigns an HTML id attribute to the component by taking the wicket:id value I specified and appending a character. So, if my original HTML had:input wicket:id=birthday id=x type=text / At runtime I get:input wicket:id=birthday id=birthdayX type=text / This messes up some static CSS/Javascript I have in the page, which relies on locating hte component using its original id. Is there a way to prevent this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Beginner: Pre-select value on RadioChoice component using compound model
Hi, I'm using the RadioChoice component on a form with a CompoundPropertyModel. I'd like the form to come up witn a specific radio option selected. So I try: RadioChoiceSex sexRadio = new RadioChoiceSex(profile.sex, Arrays .asList(Sex.values())); sexRadio.setChoiceRenderer(new SexChoiceRenderer()); sexRadio.setDefaultModelObject(Sex.FEMALE); But I get: Caused by: java.lang.IllegalStateException: Attempt to set model object on null model of component: profile.sex at org.apache.wicket.Component.setDefaultModelObject(Component.java:3033) - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
GMap2 from wicketstuff: how to dynamically resize?
Hi, I am unsing GMap2 from WicketStuff (http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-gmap2) and need to display a map in a pop-up dialog. I use JQuery for the dialog. When the Dialog comes up, the map's viewport is offset in relation to the window and only the cross-section of the map's position (starting outside the dialog window) and the actual pop-up window is being drawn. For example, assume the map starts at absolute position 0,0 with as size of 600,400 and the dialog is shown at absolute position 300,200 with size 600,500: Only the region (300,200 - 600,400) is drawn. This is probably because the dialog is not shown when the GMap2 javascript calculates its position, so I need to call the checkResize() method on http://code.google.com/apis/maps/documentation/reference.html#GMap2 that is created by the WicketStuff control. Problem is, I can't get to the Javascript object underlying the wicketstuff representation. I'm trying to do something like: myDialog.setOpenEvent(JsScopeUiEvent .quickScope( alert('fixing map size');\n + $('#mapObjectId').checkResize();\n ); How can I get the proper mapObjectId value? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: GMap2 from wicketstuff: how to dynamically resize?
Ok, looking at the sources, I found that WicketStuff adds a WebMarkupContainer which is used for the actual map. Unfortunately, it hides this object from its client code, so there's no way to access it and call gmap2container.getMarkupId(). It does however assign the class gmap to the container. So I got around this using this ugly hack: myDialog.setOpenEvent(JsScopeUiEvent .quickScope( var mapCtrl = $('.gmap').attr('id');\n + dom.getElementById(mapCtrl).checkResize(); ) ); Works if there's only one map in the page... On 16/5/2010 15:55, Alexandros Karypidis wrote: Hi, I am unsing GMap2 from WicketStuff (http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-gmap2) and need to display a map in a pop-up dialog. I use JQuery for the dialog. When the Dialog comes up, the map's viewport is offset in relation to the window and only the cross-section of the map's position (starting outside the dialog window) and the actual pop-up window is being drawn. For example, assume the map starts at absolute position 0,0 with as size of 600,400 and the dialog is shown at absolute position 300,200 with size 600,500: Only the region (300,200 - 600,400) is drawn. This is probably because the dialog is not shown when the GMap2 javascript calculates its position, so I need to call the checkResize() method on http://code.google.com/apis/maps/documentation/reference.html#GMap2 that is created by the WicketStuff control. Problem is, I can't get to the Javascript object underlying the wicketstuff representation. I'm trying to do something like: myDialog.setOpenEvent(JsScopeUiEvent .quickScope( alert('fixing map size');\n + $('#mapObjectId').checkResize();\n ); How can I get the proper mapObjectId value? - 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: GMap2 from wicketstuff: how to dynamically resize?
I guess the description was rather complicated... Anyway, the thing is: the Map2 class from the Google Maps API, apparently looks at the location and size of a div tag used as its canvas, to do some setup at page load time. When the div it targets is hidden, its size/position attributes are apparently not correct. Thus, when the div becomes visible, the Map2 object has the incorrect coordinates and size (calculated during the page load) and draws itself in a messed up state. I came across this because I had my map inside a pop-up dialog (from JQueryUI) which is initially hidden and appears at the center of the browser window when the user clicks a button. Anyway, to have the Map2 control re-calculate and re-draw itself, you need to call its checkResize() method. To do that, I needed a reference to the JavaScript object holding the map. Since I was using the module from wicket-stuff, I was looking for a way to get to that javascript object (from my Java code), so that I may dynamically generate JavaScript code that calls checkResize() when the dialog is opened and becomes visible. Anyway, the solution in my previous post was wrong. It was a way to get to the div tag that is used as the map canvas. No point in calling checkResize() on that. What I needed was the Map2 JavaScript object that is used to control the map. The correct answer (now that I got it working) is: myJQueryDialog.setOpenEvent(JsScopeUiEvent .quickScope(var mapCtrlId = $('.gmap').attr('id');\n + Wicket.maps[mapCtrlId].map.checkResize();\n )); The Wicket.maps[] object is managed by the code in wicket-gmap.js from the wicket-stuff module for maps. Reading back, I am not sure this explanation is simpler than my previous one, but hey, it IS Sunday afternoon... On 16/5/2010 16:16, Martin Funk wrote: sorry my mind is in Sunday afternoon mode, and not able to wrap itself around this... could you come up with a Quickstart example? mf Am 16.05.2010 um 14:55 schrieb Alexandros Karypidis: Hi, I am unsing GMap2 from WicketStuff (http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-contrib-gmap2) and need to display a map in a pop-up dialog. I use JQuery for the dialog. When the Dialog comes up, the map's viewport is offset in relation to the window and only the cross-section of the map's position (starting outside the dialog window) and the actual pop-up window is being drawn. For example, assume the map starts at absolute position 0,0 with as size of 600,400 and the dialog is shown at absolute position 300,200 with size 600,500: Only the region (300,200 - 600,400) is drawn. This is probably because the dialog is not shown when the GMap2 javascript calculates its position, so I need to call the checkResize() method on http://code.google.com/apis/maps/documentation/reference.html#GMap2 that is created by the WicketStuff control. Problem is, I can't get to the Javascript object underlying the wicketstuff representation. I'm trying to do something like: myDialog.setOpenEvent(JsScopeUiEvent .quickScope( alert('fixing map size');\n + $('#mapObjectId').checkResize();\n ); How can I get the proper mapObjectId value? - 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
AutoCompleteTextField: converter seems to be ignored
Hi, I'm using AutoCompleteTextFiled with Wicket 1.4.9. My model is a POJO that is specified as a generic: searchTextField = new AutoCompleteTextFieldSomePOJO(... Therefore I return an Iterator of such POJOs with: protected IteratorSomePOJO getChoices(String input) { I'm trying to customize the text displayed (which defaults to SomePOJO.toString()) using a converter: public IConverter getConverter(Class? type) { System.err.println(Looking up converter for: + type.getCanonicalName()); if (SomePOJO.class.isAssignableFrom(type)) { return new IConverter() { ... However, wicket never calls the getConverter() method and simply uses SomePOJO.toString() to retrieve the text for the choices. What am I doing wrong? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Reacting to AutoCompleteTextField choice selection event
Hi, I have an AutoCompleteTextField, for which I need to react to user selections from the choices list. For example, if a user enters Au and the choices Austria and Australia are shown, I need to be able to execute some code via a callback if the user scrolls down to one of the two choices and presses enter on one of them. Is there some behavior I can add, or callback method I can override to react to user selection? Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Reacting to AutoCompleteTextField choice selection event
Hi, I have an AutoCompleteTextField, for which I need to react to user selections from the choices list. For example, if a user enters Au and the choices Austria and Australia are shown, I need to be able to execute some code via a callback if the user scrolls down to one of the two choices and presses enter on one of them. Is there some behavior I can add, or callback method I can override to react to user selection? Reading back, I need to clarify something: what I need is to be able to access the model object that was selected by the user, Not just the textual representation created by the IAutoCompleteRenderer, but the actual object instance that produced it. To elaborate: 1) I have an AutoCompleteTextFieldSomeClass 2) It presents a list of choices using an IteratorSomeClass getChoices(String input) 3) An IAutoCompleteRendererSomeClass provides the textual representation for the choices 4) When the user selects a choice, I need to react knowing the SomeClass object instance that was chosen Due to (4), a simple AjaxFormComponentUpdatingBehavior(onchange) does not suffice: I only know the text that was provided by (3) and not the actual object instance of type SomeClass that generated it. How would I go about doing that? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Tracing attach/detach and serialization activity
Hi, I'd like to be able to observe Wicket's (de)serialization activity and model attachment/detachment at runtime. Is there some setting (e.g. specifying a DEBUG or TRACE log level) that would cause Wicket to log the relevant actions? I am using Wicket 1.4.15. Thank you. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Should Logger classes be transient?
Hello, I'm using SLF4J and was wondering whether pages should declare: private transient final Logger log = LoggerFactory .getLogger(SomePage.class); as members. I guess that accessing a page that was saved and then re-loaded would result in breaking logging, as the variable would be set to null. I've no idea how heavy-weight these Logger implementations are though and am worried that they should not be declared in class scope. What do experienced Wicket developers do to access logging? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Modify element attribute, preserve content
Hello, I have the following case which I do not know how to handle with Wicket: I have an element (specifically it is an a href=.../a link) for which I need to generate an attribute's value dynamically (specifically, I need to set the href attribute at runtime), but I need to preserve the static content of the page. For example, my HTML file is: a wicket:id=myTargetspan class=x/spansome static text/a What do I have to do to produce: a href=dynamically generated targetspan class=x/spansome static text/a So far, I've always replaced the entire content of an element with that generated by some wicket component, but this is the first time I've needed to filter part of the DOM and target something very specific in the middle of the tree, without affecting the rest of the tree... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Mixing static with dynamic items in the same list
Hello, I have a page with a simple HTML unordered list (ul), where part of the list items are static, whereas the rest of them are dynamic. To that end, I've injected a span tag at the end of the static items, adding a ListView in order to fill in the dynamic part, as follows: HTML - ul li a href=#First static item/a /li li a href=#Second static item/a /li span wicket:id=dynamicItems li wicket:id=dynamicListItem/li /span /ul Code - ListView dynamicItems = new ListView(dynamicItems, someList) { protected void populateItem(ListItem item) { Label link = new Label(dynamicListItem, a href='...' + item.getModelObject() + /a); link.setEscapeModelStrings(false); item.add(link); } }; This achieves what I need, but keeps the span tags in place (causing some unrelated CSS to miss its target elements). So, the HTML that is produced is as follows...: ul li a href=#First static item/a /li li a href=#Second static item/a /li spanliFirst dynamic item/li/span spanliSecond dynamic item/li/span spanliThird dynamic item/li/span /ul But what I want to achieve is the following clean output (notice the absence of span tags): ul li a href=#First static item/a /li li a href=#Second static item/a /li liFirst dynamic item/li liSecond dynamic item/li liThird dynamic item/li /ul How can I achieve this? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[MIGRATE 1.5] NPE trying to use JavaScriptTemplate
Hi, I've just started preparing for 1.5 and have been modifying my code in order to conform with the new API. I've managed to get my application to compile and launch, but in my first attempt to render a page I get an NPE as follows: java.lang.NullPointerException at org.apache.wicket.util.template.TextTemplateDecorator.setLastModified(TextTemplateDecorator.java:195) at org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:76) at org.apache.wicket.util.resource.AbstractStringResourceStream.init(AbstractStringResourceStream.java:62) at org.apache.wicket.util.template.TextTemplate.init(TextTemplate.java:42) at org.apache.wicket.util.template.TextTemplateDecorator.init(TextTemplateDecorator.java:52) at org.apache.wicket.util.template.JavaScriptTemplate.init(JavaScriptTemplate.java:42) at assets.wicket.ovimaps.OviMap.renderHead(OviMap.java:46) at org.apache.wicket.Component.renderHead(Component.java:2644) Now this part of the code is an adaptation of what used to be a template-based javascript header contribution as follows: add(TextTemplateHeaderContributor.forJavaScript(OviMap.class, OviMap.js, model)); The above has been removed from the component constructor (where it used to be) and replaced with the following in code inside my component: @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); JavaScriptTemplate template = new JavaScriptTemplate( new PackagedTextTemplate(OviMap.class, OviMap.js)); response.renderString(template.asString(model.getObject())); } What am I doing wrong? P.S. I am using 1.5-rc2. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Understanding Wicket 1.5 page mapping
Hello, Could you post some pseudo-code on what your request mapper looks like? I have a similar use-case but I wasn't able to follow. I created a MyRequestMapper class that wraps the default root mapper: setRootRequestMapper(new MyRequestMapper(getRootRequestMapper())); public class MyRequestMapper implements IRequestMapper { private final IRequestMapper wrappedMapper; public MyRequestMapper(IRequestMapper wrappedMapper) { this.wrappedMapper = wrappedMapper; } ... mapRequest() mapHandler() getCompativilityScore() ... } Currently I delegate to the wrapped handler. What I would like to do is peek at the URL (i.e. request.getUrl()), then decide based on some logic which page to render. However, mapRequest() returns an IRequestHandler. I would've liked to return same page class like this: @Override public IRequestHandler mapRequest(Request request) { ListString segments = request.getUrl().getSegments(); if (existsPerson(segments.get(0)) { == return PersonPage.class; } else if (existsProduct(segments.get(0)) { == return ProductPage.class; } return wrappedMapper.mapRequest(request); } How would I go about doing that? On Fri, 22 Apr 2011 23:48:54 +0300, drewzilla80 andrew.eas...@gmail.com wrote: Thanks, Martin. That's what I already ended up doing as it turns out (I dug into the code and noticed the method you specified). I've got my whole original use case working very nicely indeed - thanks for your help. dz -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.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
Re: Understanding Wicket 1.5 page mapping
Thx! On Sat, 23 Apr 2011 14:11:56 +0300, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, Could you post some pseudo-code on what your request mapper looks like? I have a similar use-case but I wasn't able to follow. I created a MyRequestMapper class that wraps the default root mapper: setRootRequestMapper(new MyRequestMapper(getRootRequestMapper())); public class MyRequestMapper implements IRequestMapper { private final IRequestMapper wrappedMapper; public MyRequestMapper(IRequestMapper wrappedMapper) { this.wrappedMapper = wrappedMapper; } ... mapRequest() mapHandler() getCompativilityScore() ... } Currently I delegate to the wrapped handler. What I would like to do is peek at the URL (i.e. request.getUrl()), then decide based on some logic which page to render. However, mapRequest() returns an IRequestHandler. I would've liked to return same page class like this: @Override public IRequestHandler mapRequest(Request request) { ListString segments = request.getUrl().getSegments(); if (existsPerson(segments.get(0)) { == return PersonPage.class; } else if (existsProduct(segments.get(0)) { == return ProductPage.class; } return wrappedMapper.mapRequest(request); } How would I go about doing that? On Fri, 22 Apr 2011 23:48:54 +0300, drewzilla80 andrew.eas...@gmail.com wrote: Thanks, Martin. That's what I already ended up doing as it turns out (I dug into the code and noticed the method you specified). I've got my whole original use case working very nicely indeed - thanks for your help. dz -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Understanding-Wicket-1-5-page-mapping-tp3467619p3468850.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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
[MIIGRATE 1.5] Where is getSharedResources().putClassAlias(...)
Hello, Here's my next question regarding migration to 1.5. I used to publish dynamic image resources (retrieved from DB) as follows: protected void init() { super.init(); getSharedResources().putClassAlias(org.apache.wicket.Application.class, global); getSharedResources().add(images, new ImageResources()); } The above would let my image resource reply to the URL: http://host/resources/global/images?params=... In 1.5, the SharedResources class no longer has a putClassAlias() method, so apparently there's something new. How do we go about doing this with 1.5? Thanks in advance! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Nesting RepeatingView components: Possible attempt to embed component(s) error
Hello, I want to add menus (as in a menu bar with drop-down menus) on my pages. In order to achieve that, I must use a nested RepeatingView (see further down for the explanation). What I need (and don't know how to do) is to be able to have markup like this: ul class=web-menu li wicket:id=menuBarChoices ul li wicket:id=menuBarChoiceItems/li /ul /li /ul In my code, I would use RepeatingView to generate a number of list-items (menuBarChoices) which would be rendered as a menu bar. In addition I would need to create a NESTED RepeatingView per each of the menuBarChoices, to generate a number of list-items (menuBarChoiceItems). These would be rendered as a drop-down menu when the user hovers over the respective menu bar choice. I tried to do that, but Wicket catches my attempt to nest the RepeatingView components and politely explains that the outer component discard its content, therefore the nested embedded component can no longer be used for dynamic content. The message is as follows: Last cause: Expected close tag for 'li wicket:id=menuBarChoices' Possible attempt to embed component(s) 'li wicket:id=menuBarChoiceItems' in the body of this component which discards its body. Ultimately, I need Wicket to produce something like this: ul class=web-menu li Menu1 ul liMenu Subitem 1/li liMenu Subitem 2/li /ul /li li Menu2 ul liMenu Subitem 1/li liMenu Subitem 2/li /ul /li /ul How do I go about doing that? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [MIIGRATE 1.5] Where is getSharedResources().putClassAlias(...)
Posted: https://issues.apache.org/jira/browse/WICKET-3640 for investigation. Is there really no alternative to this with Wicket 1.5? On Mon, 25 Apr 2011 09:19:02 +0300, Martin Grigorov mgrigo...@apache.org wrote: Please create a ticket. On Sun, Apr 24, 2011 at 12:36 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, Here's my next question regarding migration to 1.5. I used to publish dynamic image resources (retrieved from DB) as follows: protected void init() { super.init(); getSharedResources().putClassAlias(org.apache.wicket.Application.class, global); getSharedResources().add(images, new ImageResources()); } The above would let my image resource reply to the URL: http://host/resources/global/images?params=... In 1.5, the SharedResources class no longer has a putClassAlias() method, so apparently there's something new. How do we go about doing this with 1.5? Thanks in advance! - 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: Nesting RepeatingView components: Possible attempt to embed component(s) error
Hi, I actually managed to get around this by creating a component called DropDownMenu with the following HTML: html xmlns:wicket body wicket:panel span wicket:id=menu/span ul li wicket:id=menuChoices/li /ul /wicket:panel /body /html The DropDownMenu.java code creates a repeating view (the nested one) and adds the menuChoices. Then, I simply add instances of new DropDownMenu(...) to the outer RepeatingView which I've also converted into a separate MenuBar component. On Mon, 25 Apr 2011 00:13:46 +0300, James Carman ja...@carmanconsulting.com wrote: Check out the YUI menu support in wicketstuff. It works great for us. On Sun, Apr 24, 2011 at 4:41 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, I want to add menus (as in a menu bar with drop-down menus) on my pages. In order to achieve that, I must use a nested RepeatingView (see further down for the explanation). What I need (and don't know how to do) is to be able to have markup like this: ul class=web-menu li wicket:id=menuBarChoices ul li wicket:id=menuBarChoiceItems/li /ul /li /ul In my code, I would use RepeatingView to generate a number of list-items (menuBarChoices) which would be rendered as a menu bar. In addition I would need to create a NESTED RepeatingView per each of the menuBarChoices, to generate a number of list-items (menuBarChoiceItems). These would be rendered as a drop-down menu when the user hovers over the respective menu bar choice. I tried to do that, but Wicket catches my attempt to nest the RepeatingView components and politely explains that the outer component discard its content, therefore the nested embedded component can no longer be used for dynamic content. The message is as follows: Last cause: Expected close tag for 'li wicket:id=menuBarChoices' Possible attempt to embed component(s) 'li wicket:id=menuBarChoiceItems' in the body of this component which discards its body. Ultimately, I need Wicket to produce something like this: ul class=web-menu li Menu1 ul liMenu Subitem 1/li liMenu Subitem 2/li /ul /li li Menu2 ul liMenu Subitem 1/li liMenu Subitem 2/li /ul /li /ul How do I go about doing that? - 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: Could not resolve class: my.domain.favicon.ico
Hello Rene, I understand that you probably currently DON'T have a favicon for your site and you are disturbed by the browser's attempt to fetch it. First of all, you should read http://en.wikipedia.org/wiki/Favicon to see what this is about. It's the icon that browser use to decorate the address bar, bookmarks menu, etc. You are NOT required to have one. If you don't have one, the browser simply shows a generic icon in those places. The browser will however try to fetch it anyway (most browsers will try to retrieve favicon.ico from the root folder of the site), so it is normal for you to get an error in your web server's logs, reporting a miss when the browser attempts to fetch it. In your case, as Igor pointed out, due to the mounting you performed the request will end up searching for the result within your home page package. If you do add such an icon, I would recommend putting the icon file in src/main/webapp so that it is accessible from the root location. Alternatively, point to the actual URL where it can be found (e.g. inside the home page package) using the link tag above.You can change the location from which to fetch the favicon using a link tag in your page header, as follows: link rel=shortcut icon href=http://example.com/myicon.ico; / More information can be found here: http://en.wikipedia.org/wiki/Favicon#Accessibility Regards, Alexandros On Mon, 25 Apr 2011 17:55:27 +0300, Rene Stolle rene.sto...@googlemail.com wrote: Hey Igor, this sounds logically, but what is the solution. One cannot create a class favicon.ico cause of the dot, and even if, how to place your own favicon in this case?? Rene PS: I am loving 1.5! On Wed, Apr 13, 2011 at 7:35 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: you mounted the package on root, which means when the browser requests /favicon.ico wicket will think that the browser is asking for a wicket page named my.domain.favicon.ico and will try to instantiate a class with that name, thus the error. it should ultimately result in a 404 sent to the browser. -igor On Wed, Apr 13, 2011 at 2:51 AM, Christian Grobmeier grobme...@gmail.com wrote: mountPackage() will mount all *Page* classes in the same package as the page used for the mount but it doesn't do anything else, i.e. it doesn't handle components or models or ... OK, I have imagined that. But it seems mountPackage does also mount the forms. If I mountPackage everything the LoginForm is available. If I do mountPage my LoginForm is not available after I submit (same package as LoginPage). Which does not make sense to me: ComponentNotFoundException: Could not find component 'loginForm' on page 'class de.mydomain.HomePage The HomePage does not have this component at all. Even when I do: mountPage(HomePage) mountPackage(LoginPage) it changes. Only when i mountPackage everything it seems to work. Btw, HomePage is in the root folder, while LoginPage is in a subfolder. mountPage() mounts just a single page without any knowledge about other pages, panels, models ... On Wed, Apr 13, 2011 at 11:19 AM, Christian Grobmeier grobme...@gmail.comwrote: do you really need mountPackage() ? I guess you actually need #mountPage() I find mountPackage(/, HomePage.class); as the culprit if I use only mountPage it leads to the situation of some components not found. My structure is like following: /HomePage.class /App.class /pages/login/LoginPage.class /pages/login/LoginForm.class /pages/login/LoginEntities.class /pages/login/LoginBusinessLogic.class /pages/login/LoginPage.html ... The docs told me I could mount a whole package. As subfolders are not mounted, I thougth this would work. However, if I only use mountPage, the missing css error is gone. But then I am puzzled about mountPackage It seems I should restructure my app... is there a recommended way? On Wed, Apr 13, 2011 at 11:07 AM, Christian Grobmeier grobme...@gmail.comwrote: can you paste your MyApp#init() ? Sure: @Override public void init() { super.init(); getComponentInstantiationListeners().add( new SpringComponentInjector(this)); mountPackage(/, HomePage.class); mountPackage(/feedback, FeedbackPage.class); mountPackage(/login, LoginPage.class); mountPackage(/test, TestPage.class); this.getMarkupSettings().setStripWicketTags(true); loadProperties(); initSecurity(); } loadProperties load a property file from web-inf as the name suggests initSecurity is setting an getSecuritySettings().setauthorizationStrategy() - guess the latter two methods have nothing to do with my problem Cheers - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting,
Re: [osgi] package org.apache.wicket.request exported either from core and request packages
I would reverse the question and ask: why was wicket broken into multiple packages in the first place? I assume there are use cases where: - someone would need only the content of wicket-core and none of the extras - someone would need only wicket-core + wicket-request - someone would need only wicket-core + wicket-util - ... I suppose the above scenarios actually were needed and that lead to the split. If there is no practical use in having Wicket broken into multiple packages, then why do it in the first place? In any case, since I assume there is a reason for the split, I'd say that the same use-cases that apply in a non-osgi environment, also apply for the OSGi case. Projects that only need wicket-core should load only that and nothing else. Other than being leightweight for such cases, I don't see a reason why an uber-jar won't work. Now, assuming that this split is what the community and the developers want, it should be offered for both non-OSGi as well as OSGi environments. This means that we simply need to make sure there is at least one package that is unique per bundle and instruct OSGi people to do package-based imports using the non-common packages. For example, in Daniele's case, the package used in org.apache.wicket.request. However this exists in both the wicket-core and wicket-request bundles, causing the problem. A different package should be used. @Daniele: try importing org.apache.wicket.request.flow, which only exists in wicket-request. This should get you the correct bundle, without having to modify the distribution. Alternatively, you can import specific bundles rather than packages. Having said that, for what it's worth, I agree with Daniele that since this is a major release, it is a golden opportunity to do some OSGi-friendly package-renaming. On Mon, 25 Apr 2011 21:20:57 +0300, Martin Grigorov mgrigo...@apache.org wrote: It is the same conversation. You need uber-jar. At least one that combines -util, -request and -core. Everything else is optional, depending on your app needs. Can you describe what is the problem to use the uber-jar? Or what are the benefits to deploy these three jars separately in the OSGi container ? On Mon, Apr 25, 2011 at 9:08 PM, Daniele Dellafiore dani...@dellafiore.net wrote: Are you referring to this conversation? http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-rc2-and-aggregate-jar-for-osgi-td3356667.html If so, I read it and answered that I'm not interested in any solution that involves the uber-jar. I do not see any advantage in that solution over a normal war. I do not find any other advice from you and Eike, maybe you can point me out the right conversation. On Mon, Apr 25, 2011 at 6:25 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi Daniele, Me and later Eike explained to you in the other thread you started few months ago how to solve exactly this problem. It seems you didn't read it at all. Please read again the part mentioning Wicket 1.5 RC1. On Mon, Apr 25, 2011 at 6:30 PM, Daniele Dellafiore dani...@dellafiore.net wrote: I did it. Yes, the tough way but I did it. Now the 1.5RC3 quickstart app just started on my karaf 2.2 with the 1.5-SNAPSHOT I built. Basically I renamed the .util and .request packages in -core bundle to be .core.util and .core.request. I had to make a class public in another package under -request bundle to make it visible, but it's a minor thing. I open a bug on jira now... wow, is down :) well, as soon as it get back online. On Mon, Apr 25, 2011 at 4:03 PM, Daniele Dellafiore dani...@dellafiore.netwrote: it is not. I'm hacking on the trunk to make that work. Maybe a quick solution is just change org.apache.wicket to org.apache.wicket.core in the -core bundle. Of course there are some default scope classes that works through different packages but I can just make them public for now. On Mon, Apr 25, 2011 at 3:18 PM, James Carman ja...@carmanconsulting.comwrote: On Mon, Apr 25, 2011 at 10:15 AM, Daniele Dellafiore ilde...@gmail.com wrote: I think that the wicket package layout should be changed now that -util and -request bundles have been detached from -core. From an OSGi perspective, we should probably try to make sure that packages don't span jar files. Everything in org.apache,wicket.request should be in wicket-request.jar, for example. I don't know if that's the case, currently or not. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [MIIGRATE 1.5] Where is getSharedResources().putClassAlias(...)
Just for future reference: As explained by Martin in the ticket, turns out that now one must: mountResoruce(/path/to/resource, ResourceReference); So in my case it's simply: mountResource(imgres, new ResourceReference(Application.class, imgres) { private static final long serialVersionUID = 1L; ImageResources imgres = new ImageResources(); @Override public IResource getResource() { return imgres; } }); Kind regards, Alex On Mon, 25 Apr 2011 13:13:22 +0300, Alexandros Karypidis akary...@yahoo.gr wrote: Posted: https://issues.apache.org/jira/browse/WICKET-3640 for investigation. Is there really no alternative to this with Wicket 1.5? On Mon, 25 Apr 2011 09:19:02 +0300, Martin Grigorov mgrigo...@apache.org wrote: Please create a ticket. On Sun, Apr 24, 2011 at 12:36 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, Here's my next question regarding migration to 1.5. I used to publish dynamic image resources (retrieved from DB) as follows: protected void init() { super.init(); getSharedResources().putClassAlias(org.apache.wicket.Application.class, global); getSharedResources().add(images, new ImageResources()); } The above would let my image resource reply to the URL: http://host/resources/global/images?params=... In 1.5, the SharedResources class no longer has a putClassAlias() method, so apparently there's something new. How do we go about doing this with 1.5? Thanks in advance! - 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
Repeating two tags at the same level (i.e. without a container)
Hello, Can anybody recommend how to achieve the following: I need to repeat two tags at the same level, without placing them in a container. For example, the below markup shows a static div containing two dynamic div tags(one for the repeater and one for the two tags I need alongside each other): div id=onlyThisContainerNeeded div wicket:id=repeaterContainer_NOT_wanted div wicket:id=items/ /div /div For the items I use the following component to place my 2 tags (a header and a div): wicket:panel h4 wicket:id=title/h4 div psome text/p /div /wicket:panel When the repeater is rendered I get: div id=onlyThisContainerNeeded div -- I need to find a way to remove this container -- h4some title/h4 div psome text/p /div /div div -- I need to find a way to remove this container -- h4some other title/h4 div psome other text/p /div /div /div So, what can I do to get the following instead: div id=onlyThisContainerNeeded h4some title/h4 div psome text/p /div h4some other title/h4 div psome other text/p /div /div Thank you in advance! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Repeating two tags at the same level (i.e. without a container)
I am absolutely amazed that I had not used this tag until today. Thanks for pointing it out. On Fri, 29 Apr 2011 02:48:33 +0300, Zilvinas Vilutis cika...@gmail.com wrote: It's described here:https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket'XHTMLtags-Elementwicket:container Žilvinas Vilutis E-mail: cika...@gmail.com On Thu, Apr 28, 2011 at 4:47 PM, Zilvinas Vilutis cika...@gmail.com wrote: use wicket:container tag instead Regards Žilvinas Vilutis E-mail: cika...@gmail.com On Thu, Apr 28, 2011 at 4:38 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, Can anybody recommend how to achieve the following: I need to repeat two tags at the same level, without placing them in a container. For example, the below markup shows a static div containing two dynamic div tags(one for the repeater and one for the two tags I need alongside each other): div id=onlyThisContainerNeeded div wicket:id=repeaterContainer_NOT_wanted div wicket:id=items/ /div /div For the items I use the following component to place my 2 tags (a header and a div): wicket:panel h4 wicket:id=title/h4 div psome text/p /div /wicket:panel When the repeater is rendered I get: div id=onlyThisContainerNeeded div -- I need to find a way to remove this container -- h4some title/h4 div psome text/p /div /div div -- I need to find a way to remove this container -- h4some other title/h4 div psome other text/p /div /div /div So, what can I do to get the following instead: div id=onlyThisContainerNeeded h4some title/h4 div psome text/p /div h4some other title/h4 div psome other text/p /div /div Thank you in advance! - 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
Table repeater: repeat across row AND column
Hello, I am trying to create a web page that lists contact addresses in a table. My repeater can easily lay out one address per row, but I need to be able to list 2 addresses per row (actually, ideally I'd like to list N addresses per row). The problem is that ListView's operation [populateItem()] only provides you with one item to work with. So with this markup: html xmlns:wicket body wicket:panel table wicket:id=addressesTable style=width: 100%; tr wicket:id=addresses td wicket:id=address style=width: 50%;/td !-- I NEED ANOTHER CELL LIKE THE ONE ABOVE HERE td wicket:id=address2 style=width: 50%;/td -- /tr /table /wicket:panel /body /html If I uncomment the second cell above, I need to be able to access the next item, something like: final ListViewAddress rowContainer = new ListViewAddress( addresses, model) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItemAddress item) { Address a = item.getModelObject(); AddressPanel ap = new AddressPanel(address, new CompoundPropertyModelAddress( new AddressLoadableDetachableModel(a.getId(; item.add(ap); /* // DOES SUCH AN API EXIST? // if (item.hasNext()) { item.next(); a = item.getModelObject(); AddressPanel ap2 = new AddressPanel(address2, new CompoundPropertyModelAddress( new AddressLoadableDetachableModel(a.getId(; item.add(ap2); } */ } }; My only solution currently is that I convert the list of addresses to a list of address tuples (pairs), so that I am able to repeat over pairs of addresses. In short, I am just wondering if there is a better way to do this rather than (pseudocode): ListAddress addresses = myRepository.loadAddressList(); ListTupleAddress,Address addressPairs = convertToPairs(addresses); // Make the above repeater iterate over ListTupleAddress,Address having access // to two addresses per repetition Any pointers on this? Thank you in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
INullAcceptingValidator behavior
Hello, 1) I have a custom validator that implements INullAcceptingValidator. 2) A TextField component in my form has validator (1) attached to it and is setRequired(false). 3) When I submit my form with the text input empty, the validator does NOT get called. It only gets called if there is a value with the HTML input field. I was expecting that the validator would be invoked upon submission even if the text field is empty, in order to validate tha value null. At least this is what I understand as far as INullAcceptingValidator goes. However, this does not appear to happen. Instead, Wicket goes on to call the form's onSubmit() method with the value null inside my model. What am I missing? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: INullAcceptingValidator behavior
Hello again, I'm in a weird place. I've stepped through the code and located my problem in: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java At line 1383, the method validateValidators() visits all validators. While iterating, it reaches my validator BUT decides to skip it because of the check on line 1398: if (isNull == false || validator instanceof INullAcceptingValidator?) The problem is that my validator is wrapped by class ValidatorAdapter: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java As you can see, this class implements IValidatorT and therefore the check fails, even though the value of the wrapped validator is in fact an instance of INullAcceptingValidator. I would have got the expected behavior if the check was written as: if (isNull == false || validator instanceof INullAcceptingValidator? || ( // wicket should check against the actual validator: validator instanceof ValidatorAdapterT validator.getValidator() iinstanceof INullAcceptingValidator?) ) Could this be a bug? On Fri, 03 Jun 2011 12:05:46 +0300, Martin Grigorov mgrigo...@apache.org wrote: Maybe org.apache.wicket.markup.html.form.FormComponent.isInputNullable() which is overridden by org.apache.wicket.markup.html.form.AbstractTextComponent.isInputNullable() On Fri, Jun 3, 2011 at 12:00 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, 1) I have a custom validator that implements INullAcceptingValidator. 2) A TextField component in my form has validator (1) attached to it and is setRequired(false). 3) When I submit my form with the text input empty, the validator does NOT get called. It only gets called if there is a value with the HTML input field. I was expecting that the validator would be invoked upon submission even if the text field is empty, in order to validate tha value null. At least this is what I understand as far as INullAcceptingValidator goes. However, this does not appear to happen. Instead, Wicket goes on to call the form's onSubmit() method with the value null inside my model. What am I missing? - 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: INullAcceptingValidator behavior
BTW, I just located where the adapter is instantiated. Again, in: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java You will find in line 465: add((Behavior)new ValidatorAdapter(validator)); I really can't see how my INullAcceptingValidator could ever get a chance to process a null value, unless the check of validateValidators() is changed... On Fri, 03 Jun 2011 12:47:57 +0300, Alexandros Karypidis akary...@yahoo.gr wrote: Hello again, I'm in a weird place. I've stepped through the code and located my problem in: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java At line 1383, the method validateValidators() visits all validators. While iterating, it reaches my validator BUT decides to skip it because of the check on line 1398: if (isNull == false || validator instanceof INullAcceptingValidator?) The problem is that my validator is wrapped by class ValidatorAdapter: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java As you can see, this class implements IValidatorT and therefore the check fails, even though the value of the wrapped validator is in fact an instance of INullAcceptingValidator. I would have got the expected behavior if the check was written as: if (isNull == false || validator instanceof INullAcceptingValidator? || ( // wicket should check against the actual validator: validator instanceof ValidatorAdapterT validator.getValidator() iinstanceof INullAcceptingValidator?) ) Could this be a bug? On Fri, 03 Jun 2011 12:05:46 +0300, Martin Grigorov mgrigo...@apache.org wrote: Maybe org.apache.wicket.markup.html.form.FormComponent.isInputNullable() which is overridden by org.apache.wicket.markup.html.form.AbstractTextComponent.isInputNullable() On Fri, Jun 3, 2011 at 12:00 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, 1) I have a custom validator that implements INullAcceptingValidator. 2) A TextField component in my form has validator (1) attached to it and is setRequired(false). 3) When I submit my form with the text input empty, the validator does NOT get called. It only gets called if there is a value with the HTML input field. I was expecting that the validator would be invoked upon submission even if the text field is empty, in order to validate tha value null. At least this is what I understand as far as INullAcceptingValidator goes. However, this does not appear to happen. Instead, Wicket goes on to call the form's onSubmit() method with the value null inside my model. What am I missing? - 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: INullAcceptingValidator behavior
Ok, I'll open a JIRA and refer to this thread. Fix seems easy enough. On Fri, 03 Jun 2011 12:50:40 +0300, Martin Grigorov mgrigo...@apache.org wrote: Yes. It looks like a bug On Fri, Jun 3, 2011 at 12:47 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello again, I'm in a weird place. I've stepped through the code and located my problem in: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java At line 1383, the method validateValidators() visits all validators. While iterating, it reaches my validator BUT decides to skip it because of the check on line 1398: if (isNull == false || validator instanceof INullAcceptingValidator?) The problem is that my validator is wrapped by class ValidatorAdapter: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java As you can see, this class implements IValidatorT and therefore the check fails, even though the value of the wrapped validator is in fact an instance of INullAcceptingValidator. I would have got the expected behavior if the check was written as: if (isNull == false || validator instanceof INullAcceptingValidator? || ( // wicket should check against the actual validator: validator instanceof ValidatorAdapterT validator.getValidator() iinstanceof INullAcceptingValidator?) ) Could this be a bug? On Fri, 03 Jun 2011 12:05:46 +0300, Martin Grigorov mgrigo...@apache.org wrote: Maybe org.apache.wicket.markup.html.form.FormComponent.isInputNullable() which is overridden by org.apache.wicket.markup.html.form.AbstractTextComponent.isInputNullable() On Fri, Jun 3, 2011 at 12:00 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, 1) I have a custom validator that implements INullAcceptingValidator. 2) A TextField component in my form has validator (1) attached to it and is setRequired(false). 3) When I submit my form with the text input empty, the validator does NOT get called. It only gets called if there is a value with the HTML input field. I was expecting that the validator would be invoked upon submission even if the text field is empty, in order to validate tha value null. At least this is what I understand as far as INullAcceptingValidator goes. However, this does not appear to happen. Instead, Wicket goes on to call the form's onSubmit() method with the value null inside my model. What am I missing? - 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: INullAcceptingValidator behavior
https://issues.apache.org/jira/browse/WICKET-3767 On Fri, 03 Jun 2011 12:56:06 +0300, Alexandros Karypidis akary...@yahoo.gr wrote: Ok, I'll open a JIRA and refer to this thread. Fix seems easy enough. On Fri, 03 Jun 2011 12:50:40 +0300, Martin Grigorov mgrigo...@apache.org wrote: Yes. It looks like a bug On Fri, Jun 3, 2011 at 12:47 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello again, I'm in a weird place. I've stepped through the code and located my problem in: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java At line 1383, the method validateValidators() visits all validators. While iterating, it reaches my validator BUT decides to skip it because of the check on line 1398: if (isNull == false || validator instanceof INullAcceptingValidator?) The problem is that my validator is wrapped by class ValidatorAdapter: http://svn.apache.org/repos/asf/wicket/releases/wicket-1.5-RC4.2/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java As you can see, this class implements IValidatorT and therefore the check fails, even though the value of the wrapped validator is in fact an instance of INullAcceptingValidator. I would have got the expected behavior if the check was written as: if (isNull == false || validator instanceof INullAcceptingValidator? || ( // wicket should check against the actual validator: validator instanceof ValidatorAdapterT validator.getValidator() iinstanceof INullAcceptingValidator?) ) Could this be a bug? On Fri, 03 Jun 2011 12:05:46 +0300, Martin Grigorov mgrigo...@apache.org wrote: Maybe org.apache.wicket.markup.html.form.FormComponent.isInputNullable() which is overridden by org.apache.wicket.markup.html.form.AbstractTextComponent.isInputNullable() On Fri, Jun 3, 2011 at 12:00 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hello, 1) I have a custom validator that implements INullAcceptingValidator. 2) A TextField component in my form has validator (1) attached to it and is setRequired(false). 3) When I submit my form with the text input empty, the validator does NOT get called. It only gets called if there is a value with the HTML input field. I was expecting that the validator would be invoked upon submission even if the text field is empty, in order to validate tha value null. At least this is what I understand as far as INullAcceptingValidator goes. However, this does not appear to happen. Instead, Wicket goes on to call the form's onSubmit() method with the value null inside my model. What am I missing? - 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: Xforms Controls within Wicket Application
Hello, First of all, there is ambiguity in your question. I'm not sure how the above would tie into a wicket-specific question, unless you want to create an XForm--XHTML renderer/processor using Wicket as the underlying technology (which is not a good idea IMHO). In any case: 1) Are you asking whether Wicket can be used to render XForms files (as in the the XForms specification at http://www.w3.org/TR/xforms11/). In this case, the answer is NO, I'm not aware of such an XForm renderer. You could create a custom Wicket component that is given an XForm definition document and uses it to render an XHTML page, but that is a lot of work (and probably not a very efficient way to do it, as you would ideally use XSLT or something along those lines to do XML--XML transformation. There are available open-source tools like Orbeon (see http://www.orbeon.com/) which can give you this kind of functionality (including processing of the XForm submission). Now, regarding the online/offline issue: 2) Do you have a rich client application that can render the XForms (e.g. using Swing) and allow the user to save such forms locally? In that case, you would need to write code that submits the forms when the rich client has network access. The submission should probably go to some servlet (e.g. an Orbeon-managed URL). Again, I don't think this would be wicket-related. 3) If you have a web-based application for this (e.g. a bundled Tomcat running on the user machine, which they access via the browser) then the principle is a combination of (1) and (2): You would need: a) to render the forms using something like Orbeon to present HTML to the browser b) to store the form submission to the local FS (or a locally running DB which could be something like Derby) c) to implement an uploader where the user can send locally saved forms to a central server (same as what I talked about in (2) above) On 11/7/2011 4:09 μμ, sramay wrote: Hi, Rendering a document in the Xforms or storing it in a database is as you have suggested ok. The issue is there when you have xform controls inside a wicket application instead of HTML document(form) and take the imput and stores them into a database. Am I explaining my position clearly ? Regards -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Xforms-Controls-within-Wicket-Application-tp3619253p3659485.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
[Migration 1.5]: exception handling in request cycle
Hi, I'm trying to plug into the new request cycle processor of 1.5-RC5.1. I am following the instructions in the wiki page, but I seem to have run into some out-of-date info. So, according to: https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle: 1) I must create a class implementing IRequestCycleListener 2) I must bind my listener during application init() with getRequestCycleListeners().add(...); My problem is that previously when we extended the WebRequestCycle, we would preserve the default exception handling by using: @Override public Page onRuntimeException(Page page, RuntimeException e) { return super.onRuntimeException(page, e); } Now, the wiki page claims that in my listener I can: public void onException(Exception ex) { /*do nothing*/} However, the new listener interface forces you to return a handler (IRequestHandler), it does not return void as claimed in the wiki. So what do I do to return something that will tell Wicket to proceed with its default Exception handling? The actual signature is: public IRequestHandler onException(RequestCycle cycle, Exception ex) { // what do I return in order not to interfere? } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Migration 1.5]: exception handling in request cycle
Ok, thx. In terms of improving the wiki, I guess my source of confusion was that I was reading: https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-RequestCycle I fixed the signature of onException(...) and also added some comments in the sample request listener implementation (indicating that you may return null). Finally, I added a link to the page you directed me to in the Exception Handling section immediately afterwards which only mentioned the exception mapper. This should help one find that the mapper is used only in case all of the listeners return null. Alex. - Original Message From: Martin Grigorov mgrigo...@apache.org To: users@wicket.apache.org Sent: Tue, July 19, 2011 12:47:54 PM Subject: Re: [Migration 1.5]: exception handling in request cycle See the last point at https://cwiki.apache.org/confluence/display/WICKET/RequestCycle+in+Wicket+1.5 Please update the wiki page after this. The Migration wiki page has a Note point at the top that there is a Wiki label at the bottom clicking on which will show you all pages with info about 1.5. It seems this note is not quite visible to the users. Ideas how to improve that is welcome! On Tue, Jul 19, 2011 at 12:35 PM, Alexandros Karypidis akary...@yahoo.gr wrote: Hi, I'm trying to plug into the new request cycle processor of 1.5-RC5.1. I am following the instructions in the wiki page, but I seem to have run into some out-of-date info. So, according to: https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle: : 1) I must create a class implementing IRequestCycleListener 2) I must bind my listener during application init() with getRequestCycleListeners().add(...); My problem is that previously when we extended the WebRequestCycle, we would preserve the default exception handling by using: @Override public Page onRuntimeException(Page page, RuntimeException e) { return super.onRuntimeException(page, e); } Now, the wiki page claims that in my listener I can: public void onException(Exception ex) { /*do nothing*/} However, the new listener interface forces you to return a handler (IRequestHandler), it does not return void as claimed in the wiki. So what do I do to return something that will tell Wicket to proceed with its default Exception handling? The actual signature is: public IRequestHandler onException(RequestCycle cycle, Exception ex) { // what do I return in order not to interfere? } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.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
Basic l10n / i18n question: must page be re-rendered?
Hello, I have written a locale selector by extending DropDownChoice (you can see the essential stuff of the implementation below). The problem is that when the user changes the locale, the page needs to be re-rendered using the newly selected locale. This does NOT happen. Instead, only the select input box seems to be refreshed to use the new locale, whereas the rest of the page content is still rendered using the previously selected locale. However, the locale has been changed in the Session which can be seen when the user navigates to another page (e.g. by clicking on a link), as the new page is rendered using the newly-selected locale. So, how can I force the current page to be re-rendered? Implementation of my locale selector is as follows: Markup: select wicket:id=localeSelection/select Component code: public class LocaleDropDown extends DropDownChoiceLocale { //... public LocaleDropDown(final String id, final ListLocale choices) { // ... setModel(new IModelLocale() { public Locale getObject() { return getSession().getLocale(); } @Override public void setObject(Locale locale) { getSession().setLocale(locale); // need something here to tell wicket to refresh the entire page? } }); // ... } @Override protected boolean wantOnSelectionChangedNotifications() { // post an event when user changes the selected value in the drop-down box return true; } } -- Kind regards, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Basic l10n / i18n question: must page be re-rendered?
Hi Gregor, I've found a way to do this by manipulating the request cycle. However, it will only work if you don't mind losing any page state, as it generates a new page rendering. I do this by overriding onSelectionChanged(...) of the DropDownChoiceLocale as follows: @Override protected void onSelectionChanged(Locale newSelection) { super.onSelectionChanged(newSelection); // the following tells wicket to instantiate a new page using the current page's class getRequestCycle().setResponsePage(getPage().getClass()); } Maybe a more knowledgeable user could suggest a better alternative? On 23/8/2011 9:13 μμ, Gregor Kaczor wrote: I have exactly the same problem, though i use an xml file for the translations. Any help out there? On 08/23/2011 02:09 PM, Alexandros Karypidis wrote: Hello, I have written a locale selector by extending DropDownChoice (you can see the essential stuff of the implementation below). The problem is that when the user changes the locale, the page needs to be re-rendered using the newly selected locale. This does NOT happen. Instead, only the select input box seems to be refreshed to use the new locale, whereas the rest of the page content is still rendered using the previously selected locale. However, the locale has been changed in the Session which can be seen when the user navigates to another page (e.g. by clicking on a link), as the new page is rendered using the newly-selected locale. So, how can I force the current page to be re-rendered? Implementation of my locale selector is as follows: Markup: select wicket:id=localeSelection/select Component code: public class LocaleDropDown extends DropDownChoiceLocale { //... public LocaleDropDown(final String id, final ListLocale choices) { // ... setModel(new IModelLocale() { public Locale getObject() { return getSession().getLocale(); } @Override public void setObject(Locale locale) { getSession().setLocale(locale); // need something here to tell wicket to refresh the entire page? } }); // ... } @Override protected boolean wantOnSelectionChangedNotifications() { // post an event when user changes the selected value in the drop-down box return true; } } -- Kind regards, Alex - 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: Basic l10n / i18n question: must page be re-rendered?
Hi again, Just to add to this that the following will work for pages with parameters: @Override protected void onSelectionChanged(Locale newSelection) { super.onSelectionChanged(newSelection); // the following tells wicket to instantiate a new page using the current page's class getRequestCycle().setResponsePage(getPage().getClass(), getPage.getParameters()); } On 23/8/2011 10:41 μμ, Alexandros Karypidis wrote: Hi Gregor, I've found a way to do this by manipulating the request cycle. However, it will only work if you don't mind losing any page state, as it generates a new page rendering. I do this by overriding onSelectionChanged(...) of the DropDownChoiceLocale as follows: @Override protected void onSelectionChanged(Locale newSelection) { super.onSelectionChanged(newSelection); // the following tells wicket to instantiate a new page using the current page's class getRequestCycle().setResponsePage(getPage().getClass()); } Maybe a more knowledgeable user could suggest a better alternative? On 23/8/2011 9:13 μμ, Gregor Kaczor wrote: I have exactly the same problem, though i use an xml file for the translations. Any help out there? On 08/23/2011 02:09 PM, Alexandros Karypidis wrote: Hello, I have written a locale selector by extending DropDownChoice (you can see the essential stuff of the implementation below). The problem is that when the user changes the locale, the page needs to be re-rendered using the newly selected locale. This does NOT happen. Instead, only the select input box seems to be refreshed to use the new locale, whereas the rest of the page content is still rendered using the previously selected locale. However, the locale has been changed in the Session which can be seen when the user navigates to another page (e.g. by clicking on a link), as the new page is rendered using the newly-selected locale. So, how can I force the current page to be re-rendered? Implementation of my locale selector is as follows: Markup: select wicket:id=localeSelection/select Component code: public class LocaleDropDown extends DropDownChoiceLocale { //... public LocaleDropDown(final String id, final ListLocale choices) { // ... setModel(new IModelLocale() { public Locale getObject() { return getSession().getLocale(); } @Override public void setObject(Locale locale) { getSession().setLocale(locale); // need something here to tell wicket to refresh the entire page? } }); // ... } @Override protected boolean wantOnSelectionChangedNotifications() { // post an event when user changes the selected value in the drop-down box return true; } } -- Kind regards, Alex - 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
Cookies and RestartResponseException
Hi, I am using CookieUtils to store a cookie. Here's the catch though: after setting the cookie, I want to redirect the user to a new page, so that is followed immediately by a RestartResponseException: new CookieUtils().save(some-key, some-value) throw new RestartResponseException(AnotherPage.class); The net result seems to be that Wicket uses an HTTP 3xx to get the user agent to go to the new page (which is what I want, since the URL changes), but the cookie does NOT get set. If instead of RestartResponseException the I use: RequestCycle.get().setResponsePage(AnotherPage.class); ...the cookie gets set properly and the redirect occurs as desired, but I need to perform the redirect in library code, which should prevent the calling thread from proceeding beyond the redirect point (which RestartResponseException nicely addresses). Is there some way to use RestartResponseException without discarding cookies? Cheers, Alex - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Cookies and RestartResponseException
So simple... I spent the last 8 minutes (i.e. till I received your reply) playing with a custom PageProvider, trying to set the cookie in getPageInstance(), (only to find that it doesn't matter since the 3xx redirect ends up retrieving the page from the default page provider anyway). Thx! On 26/12/12 18:19, Sven Meier wrote: Use NonResettingRestartException Sven On 12/26/2012 07:11 PM, Alexandros Karypidis wrote: Hi, I am using CookieUtils to store a cookie. Here's the catch though: after setting the cookie, I want to redirect the user to a new page, so that is followed immediately by a RestartResponseException: new CookieUtils().save(some-key, some-value) throw new RestartResponseException(AnotherPage.class); The net result seems to be that Wicket uses an HTTP 3xx to get the user agent to go to the new page (which is what I want, since the URL changes), but the cookie does NOT get set. If instead of RestartResponseException the I use: RequestCycle.get().setResponsePage(AnotherPage.class); ...the cookie gets set properly and the redirect occurs as desired, but I need to perform the redirect in library code, which should prevent the calling thread from proceeding beyond the redirect point (which RestartResponseException nicely addresses). Is there some way to use RestartResponseException without discarding cookies? Cheers, Alex - 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