Re: Adding a javascript function to wicket
If you use WiQuery (which we do too, it's great), you can just let your component (Panel, WebMarkupContainer, Page) implement IWiQueryPlugin and implement statement(). On 13 jul 2011, at 20:01, Martin Grigorov wrote: > Browse the sources at > https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/jquery-parent > > On Wed, Jul 13, 2011 at 7:51 PM, hariharansrc wrote: >> I want $(document).ready() a JQuery function to execute with wicket.I know i >> want to use wiquery but anybody tell how to call JQuery function using >> wiquery >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/Adding-a-javascript-function-to-wicket-tp3665506p3665506.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 >> >> > > > > -- > 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
Re: Major session problem [GAE]
The Wicket websession has a static .get(), which will always return the ThreadLocal session instance for the current user. So you can use that and cast the result to your session, or add your own get() to your session: public static MySession get() { return (MySession) WebSession.get(); } WebPage also has his own getSession() you could use. On 9 jun 2011, at 15:02, Zeldor wrote: > norckon: > > Getting whole entity is good in my case. User can modify only his data and > no one else can even access or see it. It speeds up things too. > > Anyway, how do you invoke the rest? Without static you of course get > "non-static method cannot be referenced from a static context" compilation > error. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3585460.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: Major session problem [GAE]
Storing the User in a static field doesn't seem wise: the static field is shared between all session instances, so this will break. Besides that, I'd advise not to store the User instance itself in the session, but only the user ID (or username, or email). The User instance can be cached in a transient field, which can be checked and loaded on request by a (non-static) getUser() method. Something like this: public class MySession extends WebSession { private int userId = -1; private transient User user; public void setUser(User user) { userId = user.getId(); this.user = user; } public User getUser() { if (userId == -1) return null; if (user == null) { user = UserDAO.loadUser(userId); } return user; } @Override public void detach() { user = null; super.detach(); } } On 9 jun 2011, at 10:48, Zeldor wrote: > Hi, > > I have really serious problems with my sessions - or rather getting and > displaying data with it. It works great when tested locally, but when > deployed to GAE it acts weird. In bad way. I have no idea if it's wicket or > GAE issue, but maybe I can get some hints here. > > Problem is that: > - it quite often fails to load data, so when user logs it it shows blank > pages, without any data, that should com from session > [MySession.loggedInUser.get...] > - on very rare occasions it can show old values, that were changed long time > ago, some residue must be left over somewhere and is not cleaned and somehow > it can switch between > - and there was a case when one user could see data from other user [so > sessions switched?] > > Of course situations 2&3 can never happen. Situation 1 neither - but maybe > it can be solved by some check and reload of data? > > Some code to illustrate: > > MySession: > > public class MySession extends WebSession { > > public MySession(Request request) { > super(request); > } > > public boolean isAuthenticated() { > return (loggedInUser != null); > } > > public static User loggedInUser; > > > public User getLoggedInUser() { > return loggedInUser; > } > public void setLoggedInUser(User loggedInUser) { > this.loggedInUser = loggedInUser; > } > } > > In Login: > > ((MySession) MySession.get()).setLoggedInUser(user); > > > Later data is accessed by MySession.loggedInUser.[getters/setters here] and > persisted to datastore when anything changes. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3584894.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: Fixing redirect with relative part for mobile device
I'm afraid that's not possible. My company is using GlassFish as a standard. It should be possible to fix this, since Wicket already suggests a solution. It must be possible to get the RequestCycle somehow, right? :) On 22 feb 2011, at 19:56, Martin Grigorov wrote: > Try running your application in different web container. I remember some > version of Tomcat to had that problem. > Per JEE spec it is container's responsibility to make the redirect url > absolute. > > On Tue, Feb 22, 2011 at 8:13 PM, Pepijn de Geus wrote: > >> Hi all, >> >> I'm working on a mobile website to be accessed by all kinds of devices, >> including the Nokia N95. >> While testing we found out certain links were not working on the N95, while >> other devices and desktop browsers worked fine. I started a tcpdump and >> narrowed the problem to a redirect Wicket performs. >> >> My page is mounted on '/m/mypage' using the HybridIndexed strategy. When >> clicking this link, Wicket enables versioning by redirecting to >> '/m/mypage.0' (or any other number). The redirect however is not absolute, >> but relative; the Location header contains '/m/../m/mypage.0'. Almost all >> browsers resolve the relative part and are redirected properly. The N95 >> actually performs a request using the relative URL, which Wicket doesn't >> understand, resulting in a 404. >> >> I found some JavaDoc on WebRequest#sendRedirect(String) proposing a >> solution to this problem (although mentioning a faulty container instead of >> mobile device): >> >> http://wicket.apache.org/apidocs/1.4/org/apache/wicket/protocol/http/WebResponse.html#sendRedirect%28java.lang.String%29 >> >> I tried to use this solution, but for some reason RequestCycle.get() >> returns null while inside the sendRedirect method. I tried to figure out >> why, but the whole request cycle and unsetting/detaching is still a bit >> messy for me. >> Anybody know why this is happening, or other solutions to this problem? >> >> Thanks in advance, >> Pepijn >> >> >> >> - >> 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
Fixing redirect with relative part for mobile device
Hi all, I'm working on a mobile website to be accessed by all kinds of devices, including the Nokia N95. While testing we found out certain links were not working on the N95, while other devices and desktop browsers worked fine. I started a tcpdump and narrowed the problem to a redirect Wicket performs. My page is mounted on '/m/mypage' using the HybridIndexed strategy. When clicking this link, Wicket enables versioning by redirecting to '/m/mypage.0' (or any other number). The redirect however is not absolute, but relative; the Location header contains '/m/../m/mypage.0'. Almost all browsers resolve the relative part and are redirected properly. The N95 actually performs a request using the relative URL, which Wicket doesn't understand, resulting in a 404. I found some JavaDoc on WebRequest#sendRedirect(String) proposing a solution to this problem (although mentioning a faulty container instead of mobile device): http://wicket.apache.org/apidocs/1.4/org/apache/wicket/protocol/http/WebResponse.html#sendRedirect%28java.lang.String%29 I tried to use this solution, but for some reason RequestCycle.get() returns null while inside the sendRedirect method. I tried to figure out why, but the whole request cycle and unsetting/detaching is still a bit messy for me. Anybody know why this is happening, or other solutions to this problem? Thanks in advance, Pepijn - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: FeedbackPanel inside PropertyListView
Construct the FeedbackPanel with a filter, either a ComponentFeedbackMessageFilter or ContainerFeedbackMessageFilter. On 2 feb 2011, at 13:27, Duro wrote: > Hello, > in my FeedbackPanel, which is created inside PropertyListView I experience > this behaviour. Each item , which is created in the PropertyListView contains > a form and some data, which u can edit and a FeedbackPanel. When there is a > new message in the FeedbackPanel, it is shown in all FeedbackPanels that are > created. What do i have to do, so that the message is shown only in the one, > where it belongs? > > PropertyListView propertyListView = new > PropertyListView( >"allFiles", list) { >private static final long serialVersionUID = 612045960036358963L; > >@Override >protected void populateItem(ListItem item) { > >form.add(new FeedbackPanel("feedback")); > >form.add(textField); > > } > > later, i call textField.error("False input"); > > thx, Juraj > __ > Do You Yahoo!? > Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz > gegen Massenmails. http://mail.yahoo.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: how to set cookie domain?
Cookie itself can handle that: Cookie#setDomain(String). For session cookies, you can use the sun-web.xml, at least in GlassFish: http://download.oracle.com/docs/cd/E19776-01/820-4502/6nfvbc8id/index.html On 2 feb 2011, at 04:38, Paolo wrote: > Hi, > I want add a cookie, and I saw on this site, how to do this. > > https://cwiki.apache.org/WICKET/dealing-with-cookies.html > > ((WebResponse)RequestCycle.get().getResponse()).addCookie(new > Cookie("cookieName", "cookieValue")); > > but I need to specify also the domanin. > > I need something like this PHP code, but for Wicket: > > ini_set('session.cookie_domain', '.otherdomain.com'); > > thank you! > > - > 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
continueToOriginalDestination not working correctly
Hi all, I'm working on a website were the customer can enable a splash page that will be displayed once per session to every visitor entering the site. To achieve this, I've added a small session check with a to my BasePage, which is the parent of all webpages: if (!getSession().isSplashShown()) { SplashData splash = em.find(SplashData.class, SplashData.ID); if (splash.isEnabled()) { throw new RestartResponseAtInterceptPageException(SplashWebPage.class); } else { getSession().setSplashShown(); } } This works like expected; the user is redirected to the URL the SplashWebPage is mounted on. On the SplashWebPage, which does not extends BasePage, I've added a AjaxFallbackLink like this: session.setSplashShown(); add(new AjaxFallbackLink("close") { private static final long serialVersionUID = 1L; public void onClick(AjaxRequestTarget target) { if (!continueToOriginalDestination()) { setResponsePage(HomePage.class); } } }); Clicking this links does not work. The log tells me: "ClassName=org.apache.wicket.protocol.http.WebResponse;MethodName=redirect;|Redirecting to " (nothing after 'to', only a space) and the AJAX response reads: I was able to solve this issue by either: - Changing the link to a non-ajax one - Mounting the SplashWebPage on a path 'deeper' then the one the user originally tried te open, such as "/splash/work/please". The user is then redirected to "../../" correctly. It this a bug in Wicket, or am I doing something stupid? Thanks in advance, Pepijn
Re: Session cookie path
Found a (non-Wicket) solution using sun-web.xml: http://markmail.org/message/hi6ecymqdh7gyi4y On 29 jul 2010, at 14:02, Pepijn de Geus wrote: > Hi, > > We're running Wicket 1.4.9 on GlassFish 2.1 behind an Apache server running > on port 80. > In several Apache virtual hosts we use JkMount to mount the GlassFish > applications. > > I just found out this raises a problem: Wicket sets the session cookie path > to the servlet contextpath "/MyProject" by default. > Is there any way to configure or change this path? I couldn't find any > usefull get...Settings() methods for this. > > Thanks a lot! > Pepijn > - > 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
Session cookie path
Hi, We're running Wicket 1.4.9 on GlassFish 2.1 behind an Apache server running on port 80. In several Apache virtual hosts we use JkMount to mount the GlassFish applications. I just found out this raises a problem: Wicket sets the session cookie path to the servlet contextpath "/MyProject" by default. Is there any way to configure or change this path? I couldn't find any usefull get...Settings() methods for this. Thanks a lot! Pepijn - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org