user sees page belonging to another session
Hi, We have wicket 1.4.12 on our site at the moment, and over the last few weeks we had occasional reports of users seeing pages that belonged to another user (eg when logged in, the username on the page was for another user). The panel that displays the username was using a property model which was holding the Session object - after seeing some discussion on the list we know this is bad and will change it. But in our case memory wasn't blowing up, and it did have the username in the session. If we used the current session users might not have noticed the bug. We made a change to our base page to try and catch the problem. When a page is created with a session we stored the session id and username in the page as fields. Then onBeforeRender we check the current session's id against the id stored in the page - when they didn't match we would log the problem and redirect to an error page so the user does not see another user's data. From this we got 5 cases over a day. Most of the cases occurred when user A had logged out between 10 secs to 1 minute, user B would see a page belonging to user A. In some cases the user A had not logged out, but a new page had been instantiated in the same time frame. My guess here would be it has to do with evicting pages when the pagemap is full - logging out removes everything, creating pages will remove pages when there is no more space. 2 days ago we checked where our disk page store files were stored and it had about 500Mb of files there (which is consistent with our settings). We deleted files that were more than 2 days old - which reduced this to 40Mb. We didn't get any new cases occurring, but will keep looking. We can manage the situation by leaving this code to redirect on error and monitor the number of cases we get. We will look at going to Wicket 1.4.14 soon. Is there some place we could/should add logging (DiskPageStore?) that might detect this problem earlier? -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Can I develop without recompiling/restarting after every change?
I use DWP in Eclipse... In the server view, you have your Tomcat server listed that you can start/stop etc. When you double click it opens up the settings for runtime environment and other options. One option is something like 'serve module without publishing' - that one means it basically serves it from the target directory - and any changes to .html/.js/.css/.xml/.properties etc are available immediately without republishing. Doesn't deal with java changes though... that still requires republish - but I haven't experimented with other hot code replacement options and DWP. On 31/05/10 6:36 AM, Ray Weidner wrote: Nobody seems to have mentioned it, but I have been developing with Eclipse's Dynamic Web Projects, and it has greatly shortened my development cycle from when I was loading the project into Tomcat through the manager web interface. Basically, a DWP is able to run the server itself, and it automatically republishes a new build and restarts the server in the background. Even when I have to start it myself, it is fast, and I don't have to leave the Eclipse interface. More importantly, I am able to run my code in debug, allowing me to set breakpoints etc. I don't have enough experience with the other solutions to compare it, but it sure beats manual deployment and restarting the server every time you want to try a new build. DWP is built into Eclipse, not requiring any additional plug-ins. You just create the project as a DWP and take it from there. I ported a different project's web code into the DWP simply by copying over the relevant code, and making changes needed to build. The directory layout corresponds roughly to the internal structure of the resulting WAR file, so it's pretty easy to figure out where different files should go. When you want to create a WAR file for use outside the project, you just export the project to a WAR. Debugging and building can all be performed using Eclipses standard menu options. The only trick is that you have to create a server for your DWP, and you want to point that instance to an actual installed instance of Tomcat or JBoss. This presents you with new artifact on the Package View, and you might want to open up the Server View window for control over it (start, stop and publish are the main things to do here). That's all there is to it. On Fri, May 21, 2010 at 11:53 AM, ekallevig wrote: I'm a front-end developer trying to learn Java (total n00b) and working on a wicket application at work. The whole process feels very slow primarily because I have to recompile and restart JBoss every time I make a change. So I'm wondering what the best way is to avoid having to do this when editing .java/.js/.css/.html files during development? I'd like to just make changes and then refresh the browser to test -- is this possible? -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Bug with on IE
That is the problem with IE sending all button elements instead of the one that was clicked. Firefox and others send only the clicked button. So there is nothing that can be done on the server side, there is no way to figure out which button was actually clicked. On 29/03/10 10:20 PM, Michał Letyński wrote: Code: Form form = new Form("form1"); form.add(new Button("submitButton2") { @Override public void onSubmit() { //logic2 } }); form.add(new Button("submitButton1") { @Override public void onSubmit() { //logic1 } }); Markup: Submit2 Submit1 On ie, after clicking on "Submit 1" onSubmit() from submit button2 will be invoked. Its because IE send's the name of the button type="button" and Form#findSubmittingButton() takes this button. Is it a known problem ? Can i create a jira issues for that ? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: wicket app over https but renders some images as http
The background image url is relative to the css file. Is the request for the css file https? On Thu, Feb 11, 2010 at 12:35 PM, Steve Swinsburg wrote: > Hi all, > > I have a Wicket application that is running over HTTPS but is rendering > some images (like background images from css) over HTTP only. This causes > the 'This page contains unsecure items' type warning and inspecting the Page > Info from Firefox shows they are indeed being served over HTTP only. > > Luckily I can switch this particular site to be just HTTP and as soon as I > do that, the issues go away (obviously since its all just HTTP now). However > I cannot just run the entire app over HTTPS only, as this application is > deployed in many different contexts by many different institutions and they > may be running it over HTTP only. > > So can I force Wicket to render everything via HTTPS if its running over > HTTPS and just normal HTTP if its running as such? > > Note that I have things like: > > .someClass { > background-image: url(/library/image/silk/icon.png); > } > > so I can't just prefix all URL links since most of them come from the CSS. > > thanks, > Steve -- Jason Lea
Re: DataTable's Handling of NULL Values
Ah I see. In the end you are going to display a string n the cell, but if the string is null then it should display the default value. I guess the problem is because you are using the PropertyColumn which is a convienience implementation, and the property you are using doesn't display the right values. I think you need to change to the AbstractColumn and then you can use the DefaultModel when you override populateItem(). void populateItem(final Item cellItem, final String componentId, final IModel rowModel) { IModel auditModel = new DefaultModel(new PropertyModel(rowModel, "audit_train"), "undefined"); cellItem.add(new Label(componentId, auditModel); } The PropertyModel does the same thing that the PropertyColumn did in getting the audit_train out of the rowModel, and if it is null the DefaultModel will display the word 'undefined'. I just noticed getCssClass() doesn't get a rowModel so it sets the css class for every cell in the column but has no way to know which row the css class is for. So you will need to use the AttributeModifier to add the css class as Ernesto suggested. Norman Elton wrote: Thanks for both responses. I'm going to try them both. Two clarification questions: - In Ernesto's idea (override populateItem()), would the model still be dynamic? That is, if the table is used in a form and the data updated, would the table reflect the new change? My terminology may be a little off here. - In Jason's idea (create a wrapped model), the notion of "default" is actually an audit train object, not just a string? This wouldn't be the end of the world, since AuditTrain is just an interface and I could provide an instance of an anonymous inner class. It would have to return "undefined" for it's name property, etc. Thanks again, I will tinker with them both today. Norman - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: DataTable's Handling of NULL Values
PropetyColumn implements IStyledColumn so you can override getCssClass() and return a class if it is null instead of adding the attributemodifier. And you could create your own model to return a default string when the underlying model is null... something like this... public class DefaultModel extends AbstractWrapModel { private T default; private IModel wrappedModel; public DefaultModel(IModel wrappedModel, T default) { this.default = default; this.wrappedModel = wrappedModel; } T getObject() { T object = wrappedModel.getObject(); if (object == null) { object = default; } return object; } T getWrappedModel() { return wrappedModel; } } The above probably doesn't compile... but the idea is you can nest models to hide all the tricky logic away in one place. This is the first time I have seen AbstractWrapModel, so I hope the above is the correct usage. Ernesto Reinaldo Barreiro wrote: Maybe something like this? PropertyColumn propertyColumn = new PropertyColumn( new Model("AuditTrain"), "audit_train") { private static final long serialVersionUID = 1L; @Override public void populateItem(Item> item, String componentId, IModel rowModel) { if(rowModel.getObject().getAudit_train() != null) super.populateItem(item, componentId, rowModel); else { item.add(new Label(componentId, "No audit train")); item.add(new AttributeModifier("class",true, new Model("noaudit"))); } } }; Best, Ernesto On Sat, Jan 2, 2010 at 4:18 AM, Norman Elton wrote: I've created a DataTable, which works great. I'd like to define the behavior if a property returns NULL. For instance, this column retrieves the AuditTrain object for a given Asset: columns.add(new PropertyColumn(new Model("Audit Train"), "audit_train"); If the AuditTrain is NULL, I get a null-pointer exception. Ideally, I'd like to return a column-specific string and css class. Seems that I need to define a new IColumn. Any pointers? Has this been done before? Thanks, Norman - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: Wicket feedback
Maybe all I need is an ide that would show me the hierarchy on-line while editing in java and maybe alert whenever there is a mismatch. I think wicket bench might help with that... but in any case you can write test cases for your code using WicketTester the simplest being that the page/panel renders. If the hierarchy doesn't match you get a test failure. Then go and start testing your behaviors. Then start writing your test before you write your page/panel Test Driven Development :) ... and when your designer changes the hierarchy in html, your continuous build system will alert everyone to the test failure so you can fix it nice and early. -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: @RequireHttps - forms misbehaving
yay! But it is odd if setRedirect(true) didn't work when using a page instance. I wonder if the there is an issue with HybridUrlCodingStrategy and RequireHttps... can you mount the page you redirect to using a simple bookmarkable page and see if it works? I also noticed you have a method on your BasePage class called redirect(url) that disables wicket redirect... does that get called when you use setRedirect(true)? VGJ wrote: Jason...excellent! setResponsePage(UserAccount.class) did the trick! Thanks! Using setRedirect(true) didn't have any effect however. I had to redirect to the page class rather than a new instance of it. This works for me right now...but what happens when I'd like to pass parameters into the constructor of the page I'm redirecting to? -v -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: @RequireHttps - forms misbehaving
Here are a couple of things to try... @RequireHttps checks when the request comes into wicket and issues a redirect if it is on the wrong protocol. I wonder if it is because you are using setResponsePage(new ContactInfo()); without a redirect, so the @RequireHttps annotation is not checked but the page still renders. When you do actually submit the form on the page, wicket can then process the @RequireHttps annotation and redirects to the page and maybe loses the posted form values? If this was happening you would probably see url has not changed from http to https. Try adding setRedirect(true) or better yet use the setResponsePage(ContactInfo.class); method instead which will do a redirect for you. If the problem is still occuring, try the HttpFox plugin and look at the requests and redirects that occur and see if it does issue redirects to change to https somewhere. The other place redirects occur is with your use of HybridUrlCodingStrategy... try a different strategy to see if that causes the problem to go away. If there are still problems, you could check the session id to make sure it is not being lost when switching from http->https (HttpFox is good for seeing the cookies, and see if the jsessionid cookie changed or not) VGJ wrote: I see, I guess I misunderstood you. I wasn't able to reproduce it in a separate test application, however. It has to be encountering something in this particular application that is causing a problem. I just can't figure out what that might be, exactly. I would submit the small test case I made but it works just fine. I can't submit the application with the issue I've described, it's company code. -v -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: enclosure changes in 1.4.4
ocessorTask.java:831) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: java.lang.NullPointerException at org.apache.wicket.markup.html.internal.DirectChildTagIterator.findNext(DirectChildTagIterator.java:109) at org.apache.wicket.markup.html.internal.DirectChildTagIterator.next(DirectChildTagIterator.java:80) at org.apache.wicket.markup.html.internal.Enclosure.ensureAllChildrenPresent(Enclosure.java:236) at org.apache.wicket.markup.html.internal.Enclosure.onComponentTagBody(Enclosure.java:169) at org.apache.wicket.Component.renderComponent(Component.java:2617) ... 104 more _ Hotmail: Trusted email with powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141665/direct/01/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: Can't update TextField via Ajax after a validation error
When a field is submitted and there is a validation error, it doesn't update the model and the field will redisplay with the invalid input. This way the user can see what they typed and can fix the problem. With your populate link, you are updating the model, but wicket won't look at the model because the field is redisplaying the invalid input (in your case an empty field). If you want to update the underlying model value and ignore the previous failed validation you will need to clear the input. You could use Form.clearInput() to clear all invalid fields or testInput.clearInput() perhaps. Neil Curzon wrote: Thanks for the reply. It doesn't sound like this is exactly what I want, though. I do need my required field to be validated, always. I just don't understand why validation works when the link that fills in the Integer behind the property model is clicked first, but the same link populating and updating the field stops working after a validation error. On Fri, Sep 4, 2009 at 6:11 PM, Pedro Santos wrote: Take a look at: http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/markup/html/form/Button.html#setDefaultFormProcessing(boolean)<http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/markup/html/form/Button.html#setDefaultFormProcessing%28boolean%29> On Fri, Sep 4, 2009 at 7:01 PM, Neil Curzon wrote: Hi all, I'm having a weird problem that causes an input to refuse to update with an AjaxLink click method when there's been a validation error. One field in the form has a property model pointing to an Integer value. It's set to required, and there are other links that set the Integer value. What I see is that when I first click a link that populates the Integer under the required field, everything works fine. But when I click submit first, the populate links stop working. The handlers are still invoked, but the HTML that comes back in the Ajax Debug shows an input with value="" (even though the getModelObject() for that TextField returns the proper value in debugging statements). This results in the input always being showed empty. If I do things in the proper order, I see the correct value populate in the text field as expected. It's not just a display issue, either. The form refuses to submit successfully at all if there was a validation error first (and you don't manually enter anything into the field). Below is a simple application that reproduces the issue I'm seeing. I'm using wicket 1.3.7 but I've tried 1.4.1 with the same result. Any help would be greatly appreciated. Thanks Neil public class HomePage extends WebPage { public HomePage() { add(new TestForm("testForm")); } class TestForm extends Form { private Integer value; private FeedbackPanel feedbackPanel; private TextField testInput; public TestForm(String id) { super(id); add(feedbackPanel = new FeedbackPanel("feedbackPanel")); feedbackPanel.setOutputMarkupId(true); add(testInput = new TextField("testInput", new PropertyModel(this, "value"))); testInput.setRequired(true); testInput.setOutputMarkupId(true); add(new AjaxButton("submitButton"){ @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); } protected void onSubmit(AjaxRequestTarget target, Form form) { info("It worked!"); target.addComponent(feedbackPanel); } }); add(new AjaxLink("chooseOneLink"){ public void onClick(AjaxRequestTarget target) { value = 1; target.addComponent(testInput); target.addComponent(feedbackPanel); } }); } } } Choose 1 Submit -- Jason Lea
Re: border error
is it due to closing the tabs div with the short version instead of ? I had a feeling wicket doesn't like the version... Fernando Wermus wrote: Igor, Here it is: the border is in the page. label contents here On Fri, Jul 17, 2009 at 1:34 PM, Igor Vaynberg wrote: you dont have in PaginaTestBorder.html -igor On Fri, Jul 17, 2009 at 1:30 PM, Fernando Wermus wrote: What am I doing wrong in this very simple example? public class PaginaTestBorder extends AuthenticatedWebPage{ public PaginaTestBorder(){ add(new EmptyPanel("tabs")); MyBorder border = new MyBorder("border"); border.add(new Label("label", "I am the label")); add(border); } } MyBorder.html Everything outside of the <wicket:border> tags will be ignored. Might be handy as preview code. before the border contents after the border contents class MyBorder extends Border { public MyBorder(String id) { super(id); } } WicketMessage: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = border]] 2. [MarkupContainer [Component id = _body]] 3. [Component id = label] Root cause: org.apache.wicket.WicketRuntimeException: The component(s) below failed to render. A common problem is that you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered). 1. [MarkupContainer [Component id = border]] 2. [MarkupContainer [Component id = _body]] 3. [Component id = label] -- Fernando Wermus. www.linkedin.com/in/fernandowermus - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: Feedback Messages Not Getting Displayed When Using AjaxSubmitLink
ervice.findParcelIdentification(declaration.getPin()); if (pid == null) { error("No PIN found for PIN " + declaration.getPin()); } else { InitiateDeclarationVerifyPanel decVerifyPanel = new InitiateDeclarationVerifyPanel("verifyPanel", pid); parent.addOrReplace(decVerifyPanel); parent.setVisible(true); this.setEnabled(false); reenterPinLink.setVisible(true); target.addComponent(this); target.addComponent(parent); target.addComponent(reenterPinLink); } } }; form.add(verifyPinLink); reenterPinLink = new AjaxFallbackLink("reenterPinLink") { @Override public void onClick(AjaxRequestTarget target) { this.setOutputMarkupPlaceholderTag(true); parent.setVisible(false); verifyPinLink.setEnabled(true); target.addComponent(parent); target.addComponent(verifyPinLink); target.addComponent(pinText); target.focusComponent(pinText); this.setVisible(false); target.addComponent(this); } }; form.add(reenterPinLink); add(form); } } Does anyone know how to fix this? -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: Apache Logs, Session IDs, and PageExpiredException
I notice there are some secure requests there (https)... so I will now blindly assume you are having the same problem I had in the past... I had a problem with session ids changing when trying to swtich between secure/insecure pages. If your first request to a tomcat server is secure, and a session is created, tomcat will create a secure session id cookie that will only be sent in https requests. If you request a non-secure (http) page request it will not send the cookie, and a new insecure session cookie is created. One way to fix* this is to use a http request filter that checks for new session id cookie creation, and writing a new insecure cookie if a secure one has been created. Something like this: http://forum.springsource.org/archive/index.php/t-65651.html *when I say fix, I mean make the system less secure :) Igor Vaynberg wrote: yes, a changing sessionid will cause a page expired error because the client all of a sudden gets a new blank session. changing session ids can be caused by either session expiration or a manual session invalidation - like during a logout procedure. you have to figure out what causes the session to get dumped and a new one to be created in your application/servlet container. -igor On Thu, Jun 11, 2009 at 9:56 AM, Dane Laverty wrote: I'm trying to track down the source of frequent PageExpiredExceptions that we're getting on our deployment server. One of the errors occured at 01:28:06 this morning. In the Apache logs, I discovered that the user's session ID spontaneously changed at that time, (see the change between lines 4 & 5 below, and then again between lines 11 & 12). Is that just a coincidence, or would a changing session ID cause the PageExpiredException? And if so, what causes the session ID to change? (I'm using Wicket 1.3.6. I can't replicate the errors in development, which sounds common according to the several PageExpiredException threads. I'm not seeing any sort of serialization errors either.) Thanks for your help! XXX.XXX.29.22 - - [11/Jun/2009:01:28:03 -0700] "GET /resources/comp.Comp/Oregon2.jpg HTTP/1.1" 200 22145 " https://www.foodhandler.org/login%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:03 -0700] "GET /resources/comp.Comp/newVGrad.png HTTP/1.1" 200 48736 " https://www.foodhandler.org/login%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:03 -0700] "GET /resources/comp.Comp/navBoxBottom.jpg HTTP/1.1" 200 14140 " https://www.foodhandler.org/login%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:05 -0700] "GET /pay%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3 HTTP/1.1" 302 - "-"... XXX.XXX.29.22 - - [11/Jun/2009:01:28:05 -0700] "GET /foodhandler/login;jsessionid=271042707F280E26F7A08E6FFF108C22 HTTP/1.1" 302 263 "-"... XXX.XXX.29.22 - - [11/Jun/2009:01:28:05 -0700] "GET /login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 HTTP/1.1" 200 8056 "-"... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /resources/comp.Comp/main.css HTTP/1.1" 200 9904 " https://www.foodhandler.org/login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /resources/comp.Comp/print.css HTTP/1.1" 200 459 " https://www.foodhandler.org/login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js;jsessionid=271042707F280E26F7A08E6FFF108C22 HTTP/1.1" 200 8939 " https://www.foodhandler.org/login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js;jsessionid=271042707F280E26F7A08E6FFF108C22 HTTP/1.1" 200 1184 " https://www.foodhandler.org/login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /resources/comp.Comp/prototype.js HTTP/1.1" 200 47603 " https://www.foodhandler.org/login%3bjsessionid=271042707F280E26F7A08E6FFF108C22 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:06 -0700] "GET /%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3?wicket:interface=:12 HTTP/1.1" 200 4623 " https://www.foodhandler.org/take-the-test%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3 "... XXX.XXX.29.22 - - [11/Jun/2009:01:28:07 -0700] "GET /resources/comp.Comp/main.css HTTP/1.1" 200 9904 " https://www.foodhandler.org/%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3?wicket:interface=:12::: :"... XXX.XXX.29.22 - - [11/Jun/2009:01:28:07 -0700] "GET /resources/comp.Comp/print.css HTTP/1.1" 200 459 " https://www.foodhandler.org/%3bjsessionid=E0381EA98B6C107CD1D4DF8FDE5D88C3?wicket:interface=:12::: :"... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: wicket-ajax and IE performance problems for pages with many links
I have tracked down the issues in slow IE performance when adding focus events to 1000's of elements. I created a simple page with 1000 normal links using a listview, then measured the performance of the wicket-ajax.js Wicket.Focus.attachFocusEvent method. It would take about 3000ms on page load, and around 500ms on each ajax response (tested using a simple ajax link that does nothing in the onClick() method). When the focus event is added to an element in IE, wicket-event.js Wicket.Event.getId will add an id to any element that does not have one. This takes 2200ms for my test page. If use setOutputMarkupId(true) on my links, then Wicket.Event.getId doesn't create one, and the Wicket.Focus.attachFocusEvent time drops to 700ms the ajax response time is unaffected. NOTE: if you create millions of links, make sure you use .setOutputMarkupId(true) so this focus code doesn't have to create one for you. We can get these numbers down by fixing a function in wicket-ajax.js Wicket.Focus.setFocusOnElements: setFocusOnElements: function (elements) { // we need to cache array length because IE will try to recalculate // the collection of elements every time length() is called which can be quite expensive // if the collection is a result of getElementsByTagName or a similar function. var len=elements.length; for (var i=0; i< len; i++) { if (elements[i].wicketFocusSet != true) { Wicket.Event.add(elements[i],'focus',Wicket.Focus.setFocus); Wicket.Event.add(elements[i],'blur',Wicket.Focus.blur); elements[i].wicketFocusSet = true; } } }, Fetching the elements.length once will bring the numbers down to 220ms for page load and 30ms for ajax update. Igor committed the "var len=elements.length;" change into 1.3.x and 1.4.x already, so that should be all good :) As a comparision... firefox takes 70ms for Wicket.Focus.attachFocusEvent on page load and 5ms for ajax response. -jason lea James Carman wrote: Okay, since this code does show that the problem is with the focus stuff and we have conflicting goals here, what are we going to do to move forward? Obviously, the IE JS engine is way too darn slow to handle this code. Is there some optimization we can do here? Should we file a JIRA? Is there one change in particular that made this so slow in IE? Do we back that out until a better alternative is known? Why am I asking so many questions? :) Sorry, too much coffee this morning. 2009/4/17 Peter Gardfjäll : Sure, here goes. I have added both the java and the js file to the same Java package: WicketAjaxJsPatch.java == /** * {...@link IBehavior} that should be added to {...@link Page}s that need to prevent * the page load performance penalty incurred when wicket-ajax.js traverses all * <a> tags in the page markup. * * * For background information, see http://www.nabble.com/wicket-ajax-and-IE-performance-problems-for-pages-with-many-links-td23078336.html"; * >this mailing list thread * * This behavior simply makes sure that our patch gets applied to wicket-ajax.js * (by forcing wicket-ajax.js to be added to the page head prior to * wicket-ajax-patch.js). * */ public class WicketAjaxJsPatch extends AbstractDefaultAjaxBehavior { @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.renderJavascriptReference(new ResourceReference( WicketAjaxJsPatch.class, "wicket-ajax-patch.js")); } @Override protected void respond(AjaxRequestTarget target) { // Does nothing. The fact that we are extending // AbstractDefaultAjaxBehavior means that we will pull in // wicket-event.js and wicket-ajax.js. The job of this behavior is to // make sure that our wicket-ajax-patch.js script gets added to the page // head after those scripts. } } wicket-ajax-patch.js === /** * Overrides the attachFocusEvent function registered by wicket-ajax.js. * The original version traverses all anchor and button tags on the page * which incurs a major performance penalty on pages with many links. * This version skips these elements in the scanning. */ if (typeof(Wicket) != "undefined") { if (typeof(Wicket.Focus) != "undefined") { // Deregister old attachFocusEvent function handlers = Wicket.Event.domReadyHandlers; filteredHandlers = new Array(); for(i = 0; i < handlers.length; i++) { if (handlers[i] != Wicket.Focus.attachFocusEvent) { filteredHandlers.push(handlers[i]); } } Wicket.Event.domReadyHandlers = filteredHandlers; // Redefine and re-register attachFocusEvent Wicket.Focus.attachFocusEvent=function() { Wicket.Focus.setFocusOnElements(document.get
Re: wicket-ajax and IE performance problems for pages with many links
nal commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: maven-eclipse-plugin 2.6 will break your wicket projects
Looks like we have to wait for 2.6.1 or 2.7 "Known Issues: * [MECLIPSE-443] - Only include **/*.java in Java source directories may affect you if you use ajdt or have non-java sources in your directories that you expect to be compiled Release 2.6.1 (which may get renamed to 2.7) has fixed this issue and will be released shortly." http://www.mail-archive.com/d...@maven.apache.org/msg80176.html Martijn Dashorst wrote: Some brilliant guy thought it prudent to make the maven-eclipse-plugin only accept .java files from src/main/java and src/test/java in version 2.6. Do not upgrade to this maven-eclipse-plugin version if you intend to keep on working with your wicket projects in the way Wicket Intended. Always specify which plugin version you want to use and only manually upgrade when you are sure it won't inflict havoc on your co-workers. This is a maven best practice! Martijn - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WicketTester assertPageLink and BookmarkablePageLink
I ran into the same problem the other day. I quickly added a method to our test helper that we extend to do this. I had a quick look at the code to see what it was doing for the assertPageLink, and testing Bookmarkable links is easier... something like public void assertBookmarkablePageLink(final String path, final Class expectedPageClass) { final BookmarkablePageLink pageLink = (BookmarkablePageLink)getComponentFromLastRenderedPage(path); final Class pageClass = pageLink.getPageClass(); Assert.assertEquals("expect bookmarkablepagelink that links to the expected class",expectedPageClass, pageClass); } Alan wrote: Thanks Martijn for your answer, but I think I didn't make myself clear enough, I'm writing a JUnit test for a custom component (subclass of Panel), This custom component is made of several standard components such as Label, and BookmarkablePageLink I want to test that this component is rendered correctly. So I use a WicketTester to render the Component, then assertLabel for the Label objects. But I didn't find how to test the BookmarkablePageLink object. The only way I found to check that a link is present is to do assertComponent("mylink",BookmarkablePageLink.class); but it is not explicit enough to test that the BookmarkablePageLink actually goes to the Link I have created. Thus my original question, is there something equivalent to assertLabel, for a BookmarkablePageLink ? Or am I mistaking totally? [image: :)] Alan 2009/4/1 Martijn Dashorst clickLink("book"); assertRenderedPage(Book.class); Martijn On Tue, Mar 31, 2009 at 11:56 PM, Alan wrote: Hi ! I have a very quick question. Is there a way to test a BookmarkablePageLink ? Something similar to the assertPageLink method? Thanks, Alan -- Jason Lea
Re: onLoad never fires -- is there a bug in 1.4?
I wonder if this is related to a bug that was fixed in firefox 3.0.6... https://bugzilla.mozilla.org/show_bug.cgi?id=444322 "Firefox 3 onload and DOMContentLoaded event firing before the page is fully loaded" We experienced that problem with Firefox 3.0.5 made a work around for it, and then 3.0.6 arrived and fixed it But there is another bug mentioned in comment #72 https://bugzilla.mozilla.org/show_bug.cgi?id=444322#c72 which might be similar to this problem (even mentions using an alert will cause the problem to appear) Brill Pappin wrote: Addendum to my last: Apparently the simple alert case *is* working in Safari 3.2.1 but *is not* in Firefox 3.0.6. This suggests to me that the script has not been updated for Firefox, or that firefox just doesn't support the script (which I find hard to believe). is anyone else using this method of capturing onLoad events? - Brill On 21-Feb-09, at 2:14 PM, Brill Pappin wrote: I have a panel with which I'm implementing IHeaderContributor and the following code: @Override public void renderHead(IHeaderResponse response) { response.renderOnLoadJavascript("alert('test')"); } ... which output in the HTML: ... <!--/*--><![CDATA[/*><!--*/ Wicket.Event.add(window, "load", function(event) { alert('test');}); /*-->]]>*/ ... However no matter what I seem to do (i've tried this about six different way so far) the alert *never* fires (note: my actual script is more complex, but I'm using alert to debug). I've also tried it in both Safari 3.2.1 and Firefox 3.0.6 with the same result (i.e. nothing happens) Is there a known bug in 1.4-SNAPSHOT? Does anyone else have this working? - Brill - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Jason Lea
Re: What is your experience on the time of development ?
Well, funny you should mention this... I had a thought a few weeks ago about starting a blog to show how I have been doing TDD with Wicket. It seems like it is quite easy to do, but there were not many posts discussing ways do do some testing or examples of testing things ajax components etc I have a couple of posts, just getting some of the basics set up... http://empty-your-cup.blogspot.com/ Hopefully I can get some time to demonstrate some simple page and component tests soon. Page testing can be fairly easy because you can just use the WicketTester to start the page. Testing a component can be a bit trickier sometimes because you need to use something like the TestPageSource. Tests generally cover behaviour, for example "if I press this button a panel X should be shown", "The name text field should contain the name of the user", "Changing the first name updates the name in the model", "Errors should have a CSS class of 'error' added". All of these things are quite straight forward to test. We rely on some components working correctly eg that the TextField will generate a valid html textfield, so we shouldn't have to test that. We can test the behaviour of ajax calls - as long as the behaviour is something simple like the component should be updated/hidden/shown by checking it is in the ajax response. The unit tests won't check that the CSS class 'error' shows the text in red with twinkling lights, but that isn't a behaviour. So we still have perhaps some manual testing, in various browsers, to make sure it looks ok. If someone changes some java code which stops a component displaying our unit tests should be able to fail and show us the cause. If someone changes the CSS and makes errors appear green... well, hopefully someone will notice that quickly. I hope that gives you a hint. Stay tuned for more in the blog... today was my first day back at work in the new year so it might have to wait a short time! ZedroS wrote: Jason Lea wrote: We decided to do Test Driven Development because we could use the WicketTester to help in development of our pages/components. Hum, very interesting : the wicket testers classes are really functional and efficient. I didn't look deep into them, considering (wrongly apparently) that even if the tests would pass I couldn't be sure that the page would be rendered fine. What's your feedback on this point ? Furthermore, is it easy as well to test only components ? Or do you have to do "unit component tests" ? To sum up my mail, I would love to have more insight of Wicket and TDD... :$ Thanks in advance ;) cheers zedros -- Jason Lea
Re: debugging
Eclipse WTP+Tomcat is really great :) The other setting I think you need is in the Server view, double click the tomcat server and use 'Serve modules without publishing' so it doesn't have to restart the server for changes (hot code/markup). For me it is nice to be able develop/test on the same server version the application will be deployed on. John Krasnay wrote: I use Tomcat via the Eclipse WTP. Here are some quick instructions if you're using Maven: - add the wtpversion and wtpContextName elements to your maven-eclipse-plugin config org.apache.maven.plugins maven-eclipse-plugin true true 2.0 oneid-web - regenerate your Eclipse project: mvn eclipse:eclipse - in Eclipse, refresh your project. You should see a little globe in the top right corner of your project icon. - open the Servers view, right click it, and add a Tomcat server. You'll have to tell it about your Tomcat install directory. - right-click your newly created server, select Add and Remove Projects..., and add your project to the server. - start the server by clicking the little bug icon in the Servers view. I've heard others on this list favour Jetty over Tomcat for reasons of startup time and hot code replace, but I've not had either problem with Tomcat. It starts fast (~10 seconds for my app, most of which is starting up Spring and Hibernate), and hot code replace works unless I'm changing the "shape" of a class (e.g. adding fields or methods). jk On Tue, Dec 23, 2008 at 11:34:41AM +0100, Björn Tietjens wrote: Hi, I am developing a webapp with wicket on eclipse, deploying as war, using a local tomcat for testing. What is the best/easiest way to debug my app with eclipse? How can I deploy/start the webapp from within eclipse or how can I attach eclipse to tomcat in order to debug my code? Thanx for your help. Cheers Björn - 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 -- Jason Lea
Re: What is your experience on the time of development ?
Our company started with Tapestry 5 last year. Early this year we had the chance for the team to try Wicket after getting frustrated with Tapestry. I wrote a small comment here about it: http://www.theserverside.com/news/thread.tss?thread_id=50634#268364 Tapestry 5 seemed to be fast due to the live class reloading. So you would code a bit, check the page in your browser, and then code a bit more. But as soon as you hit a problem it seemed to take hours to get around it. We had to write lots of custom ajax and javascript for all sorts of simple cases. This left us with pages that generally worked but without any tests to confirm behaviour. It think the java classes looked ugly too, with various public getters for anything that should appear on the page. It made it hard to estimate how long a page would take because we would hit tricky problems quite often. When we changed to Wicket, the speed tended to be the same at first which was surprising. We decided to do Test Driven Development because we could use the WicketTester to help in development of our pages/components. We finished the 2 month project in the same time as we estimated for doing it in Tapestry 5, but were were also writing unit tests and 3/4 of the team were learning Wicket. Also our estimates for doing the project in Tapestry involved sharing components from our existing application. We are much faster now, our estimates are very accurate now, we have lots of tests so we are happy to refactor/maintain code. The style of coding is quite different now. We set up the basic html + wicket class, write a test to make sure the page renders, then start adding more tests and components. After an hour of writing tests/code we might check it once in the browser. It gives you a great feeling to spend that much time in the IDE, getting lots of green bars as the tests pass then launch it in the browser and it just works. We are now rewriting the existing application in Wicket, page by page, moving components+tests we wrote into a shared module so we can use them in both projects. Re-use yay! So I guess we could say our development time might be 1.5 - 2 times faster. Our maintenance is faster again, maybe 4-6 times, because we can just write a new test to show the behaviour we want, fix the code and we can be confident we haven't broken anything else. With our old application we would have to test the page/ajax/javascript by hand. Martin Sachs wrote: I'm looking for a little comparison of the development-time for Applications in Wicket against other Technologies. I think the development with Wicket is two times faster than Struts. But what are your experiences on JSF, Rails/Grails, SpringMVC/SpringWebFlow. Anyone you know the development-time from experience ? (P.S.: The applications must use AJAX and many custom components or tags in JSP, not just a hello world sample) -- Jason Lea - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [OT] wicket users around the world
Christchurch, New Zealand (which is also not part of Australia) -- working for a German company Michael Sparer wrote: Dornbirn, Austria - note that it's Austria and not Australia - there are no kangaroos hopping around here ... forgot how often I had to explain that there exists a country in Europe with that name :-) francisco treacy-2 wrote: to know a little bit more of our great (and vast) community, i was just wondering if you're keen on sharing where you come from and/or where you work with wicket... for instance, here argentinian/belgian working with wicket in antibes, france francisco - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - Michael Sparer http://talk-on-tech.blogspot.com -- Jason Lea
Re: how to register IConverters
We followed the wiki: http://cwiki.apache.org/WICKET/using-custom-converters.html So in our Application class we have @Override protected IConverterLocator newConverterLocator() { final ConverterLocator converterLocator=new ConverterLocator(); converterLocator.set(Long.class, new MyLongConverter()); converterLocator.set(BigDecimal.class, new MyBigDecimalConverter()); return converterLocator; } We only had to create MyLongConverter and MyBigDecimalConverter, and just used the existing ConverterLocator. We only created the converters so we could have longs and bigdecimals appear with digit groups eg 1,234,567.89 lars vonk wrote: Hi Timo, thanks for replying. Normally you can just register converters in init() of your Application subclass. How is this done? What method do I call? The only way I see to add your own converters is the way I described previously or explicitly cast the IConverterLocator an org.apache.wicket.util.convert.ConverterLocator since there is no set method on the IConverterLocator interface that allows to add converters. Or am I overlooking something? Thanks in advance, Lars On Wed, Jul 23, 2008 at 6:16 AM, Timo Rantalaiho <[EMAIL PROTECTED]> wrote: On Mon, 21 Jul 2008, lars vonk wrote: Is it maybe an idea to change this to a registerConverter(IConverter) method that I can call? That saves me a custom IConverterLocator to implement. Normally you can just register converters in init() of your Application subclass. You only need your own IConverterLocator implementation if you want more specialised way of locating converters than the default (for example, to support Hibernate proxies). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oyhttp://www.ri.fi/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea